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}