Welcome to Decentralized Real Estate Market’s documentation!

Contents:

Introduction

Decentralized Real Estate Market API

Work in Progress

This API is a work in progress, and is subject to change. The goal is to make the API stateless, but as of this writing this is not the case.

In this documentation the payload for all API calls are explained.

Class diagram

The following diagram shows the design of our data model used in the market:

class_diagram.png

RESTful API

Overview

The RESTful API allows you to control the decentralized mortgage market with external software.

Endpoints

Campaigns

class market.restapi.campaigns_endpoint.CampaignInvestmentsEndpoint(market_community, campaign_id)[source]

This class handles requests regarding investments of a particular campaign

render_GET(request)[source]
GET /campaigns/(string: campaign_id)/investments

A GET request to this endpoint returns a list of investments of a campaign.

Example request:

curl -X GET http://localhost:8085/campaigns/8593AB_89/investments

Example response:

{
    "investments": [{
        "investor_id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
        "amount": 9000,
        "duration": 24,
        "interest_rate": 4.9,
        "mortgage_id": "8593AB_89",
        "status": "ACCEPTED"
    }, ...]
}
class market.restapi.campaigns_endpoint.CampaignsEndpoint(market_community)[source]

This class handles requests regarding campaigns in the mortgage market community.

render_GET(request)[source]
GET /campaigns

A GET request to this endpoint returns information about the ongoing campaigns.

Example request:

curl -X GET http://localhost:8085/campaigns

Example response:

{
    "campaigns": [{
        "id": 8593AB_23,
        "mortgage": {
            "user_id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
            "house": {
                "postal_code": "8593AB",
                "house_number": "23",
                "address": "Teststraat, Rotterdam",
                "price": 395000,
                "url": "http://www.funda.nl/koop/hollandscheveld/huis-49981036-3e-zandwijkje-8/",
                "seller_phone_number": "+31685938573",
                "seller_email": "seller@gmail.com"
            },
            "bank": "ABN",
            "amount": 395000,
            "bank_amount": 200000,
            "mortgage_type": "FIXEDRATE",
            "interest_rate": 5.3,
            "max_investment_rate": 4.3,
            "default_rate": 4.3,
            "duration": 120,
            "risk": 300000,
            "status": "ACCEPTED"
        },
        "amount": "195000",
        "end_date": "23-08-2017",
        "completed": False
    }, ...]
}
render_PUT(request)[source]
PUT /campaigns

A PUT request to this endpoint will create a new campaign. Various parameters are required: - mortgage_id: the identifier of the mortgage. This mortgage should be yours and be accepted.

Example request:

curl -X PUT http://localhost:8085/campaign --data "mortgage_id=8593AB_89"

Example response:

{"success": True}
class market.restapi.campaigns_endpoint.SpecificCampaignEndpoint(market_community, campaign_id)[source]

This class handles requests for a specific campaign.

render_GET(request)[source]
GET /campaigns/(string: campaign_id)

A GET request to this endpoint returns detailled information about a specific campaign.

Example request:

curl -X GET http://localhost:8085/campaigns/8593AB_89

Example response:

{
    "campaign": {
        "id": "8593AB_89",
        "user_id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
        "mortgage": {
            "user_id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
            "house": {
                "postal_code": "8593AB",
                "house_number": "23",
                "address": "Teststraat, Rotterdam",
                "price": 395000,
                "url": "http://www.funda.nl/koop/hollandscheveld/huis-49981036-3e-zandwijkje-8/",
                "seller_phone_number": "+31685938573",
                "seller_email": "seller@gmail.com"
            },
            "bank": "ABN",
            "amount": 395000,
            "bank_amount": 200000,
            "mortgage_type": "FIXEDRATE",
            "interest_rate": 5.3,
            "max_investment_rate": 4.3,
            "default_rate": 4.3,
            "duration": 120,
            "risk": 300000,
            "status": "ACCEPTED"
        },
        "amount": "195000",
        "end_date": "23-08-2017",
        "completed": False
    }
}
class market.restapi.campaigns_endpoint.SpecificCampaignInvestmentEndpoint(market_community, campaign_id, investment_id)[source]

This class handles requests for a specific investment in a campaign

render_PATCH(request)[source]
PATCH /campaigns/(string: campaign_id)/investments/(string: investment_id)

A PATCH request to this endpoint will accept/reject an investment offer. This is performed by the borrower of a mortgage.

Example request:

curl -X PATCH http://localhost:8085/campaigns/8948EE_43/investments/4344503b7e797ebf31582327a5baae35b11bda01
--data "state=ACCEPT"

Example response:

{"success": True}

Loan requests

class market.restapi.loanrequests_endpoint.LoanRequests(market_community)[source]

This class handles requests regarding loan requests in the mortgage market community. Only accessible by financial institutions.

render_GET(request)[source]
GET /loanrequests

A GET request to this endpoint returns a list of loan requests. Only accessible by financial institutions.

Example request:

curl -X GET http://localhost:8085/loanrequests

Example response:

{
    "loan_requests": [{
        "id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_8948AB_16",
        "user_id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
        "mortgage_type": "FIXEDRATE",
        "banks": ["ABN", "RABO"],
        "description": "...",
        "amount_wanted": 395000,
        "status": "PENDING"
    }, ...]
}
class market.restapi.loanrequests_endpoint.SpecificLoanRequestEndpoint(market_community, loan_request_id)[source]

This class handles requests for a specific loan request.

render_PATCH(request)[source]
PATCH /loanrequests/(string: loan_request_id)

A PATCH request to this endpoint will accept/reject a loan request. This is performed by a financial institution.

Example request:

curl -X PATCH http://localhost:8085/loanrequests/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3_8948AB_16
--data "state=ACCEPT"

Example response:

{"success": True}

Users

class market.restapi.users_endpoint.SpecificUserEndpoint(market_community, pub_key)[source]

This class handles requests for a specific user, identified by their public key.

render_GET(request)[source]
GET /user/(string: user_id)

A GET request to this endpoint returns information about a particular user in the system.

Example request:

curl -X GET http://localhost:8085/user/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3

Example response:

{
    "user": {
        "id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
        "role": "BORROWER",
        "time_added": "29-03-2017 13:59:39"
    }
}
class market.restapi.users_endpoint.SpecificUserProfileEndpoint(market_community, pub_key)[source]

This class handles requests regarding the profile of a specific user.

render_GET(request)[source]
GET /user/(string: user_id)/profile

A GET request to this endpoint returns information about a profile of a user.

Example request:

curl -X GET http://localhost:8085/user/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3/profile

Example response:

{
    "profile": {
        "type": "investor",
        "first_name": "Piet",
        "last_name": "Tester",
        "email": "piettester@gmail.com",
        "iban": "NL90RABO0759395830",
        "phone_number": "06685985936"
    }
}
class market.restapi.users_endpoint.UsersEndpoint(market_community)[source]

This class handles requests regarding users in the mortgage market community.

render_GET(request)[source]
GET /users

A GET request to this endpoint returns information about the known users in the system.

Example request:

curl -X GET http://localhost:8085/users

Example response:

{
    "users": [{
        "id": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
        "role": "BORROWER",
        "time_added": "29-03-2017 13:59:39"
    }, ...]
}

You

Indices and tables