This repository has been archived by the owner on May 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
APIv1
Wojtek Bednarzak edited this page Apr 22, 2018
·
9 revisions
GET /api/v1/properties
Parameters
Name | Type | Description |
---|---|---|
price_min |
int |
Minimum asking price |
price_max |
int |
Maximum asking price |
Response
Status: 200 OK
[
{
"url": "/property/1",
"id": 1,
"eircode":"H17HER3",
"asking_price": 400000,
"last_bid_price": 700000,
"posted_timestamp": 363737465,
"auction_close_timestamp": 6363737375,
}
]
POST /api/v1/login
Parameters
Name | Type | Description |
---|---|---|
email |
string |
User email address |
password |
string |
User password. This may or may not be already somewhat secured by the client-side. But the server should use this to compare |
Response
Status: 200 OK
{
"token": "abc123def456"
}
The token is used for each request which requires the user to be logged in.
Response in case of bad login
Status: 403 Forbidden
{
"error":"Email or password incorrect"
}
POST /api/v1/register
Parameters
Name | Type | Description |
---|---|---|
email |
string |
Email address of the user |
password |
string |
User's password |
Response
Status: 200 OK
{
"token": "abc123def456"
}
In case of successful registration the user would automatically be logged in as well
Response in case the registration fails
Status: 403 Forbidden
{
"error":"email already in use"
}
POST /api/v1/property/new
Parameters
Name | Type | Description |
---|---|---|
token |
string |
User token used to make sure the user is logged in |
eircode |
string |
Eircode of the property |
address |
string |
Human friendly address derived from the eircode. |
description |
string |
User defined description, in Markdown, plain text or (escaped) HTML |
property_type |
int |
Type of the property. 1 for house, 2 for apartment |
asking_price |
int |
Minimum request price |
bedrooms |
int |
Number of bathrooms |
bathrooms |
int |
Number of bathrooms |
area |
int |
Area of the house |
garage |
bool |
Has garage, both for houses and apartments |
parking |
bool |
Parking available |
alarm |
bool |
Alarm is equipped |
pets_allowed |
bool |
Pets are allowed |
self_sustainable |
bool |
The house is self sustainable, green, carbon neutral |
auction_close_timestamp |
int |
Unix timestamp in seconds when the auction gets closed. |
posted_timestamp |
int |
Unix timestamp in seconds when the property was posted. |
viewing_times |
string |
Viewing times of the property, encoded as %s-%s where first value is starting time, and second time is closing time. The times are encoded as time in minutes since midnight - 09:00 would become 9*60 = 540 , and 18:30 would be 18*60 + 30 = 1110 . This means that the time must not exceed 1440 . If it does, the server would return an error. |
This table also serves as the primary definition for what is stored.
Response
Status: 200 OK
{
"id":2
}
Response in case of failure
{
"error":"invalid token",
}
GET /api/v1/property/:id
Response
Status: 200 OK
{
"eircode":"D09FW22",
"asking_price":36500000,
"description":"The Helix is a multi-purpose venue located on the Dublin City University Glasnevin campus in Dublin. It was officially opened by then President of Ireland, Mary McAleese on the 21 October 2002. The Helix consists of a Concert Hall, Theatre, Studio Theatre, Exhibition Area, Artists in Residence Studios and full support spaces.",
"bedrooms": 0,
"bathrooms": 20,
"area": 12000,
"garage": false,
"parking": true
"alarm"
"pets_allowed": false
"self_sustainable": false,
"auction_close_timestamp": 1524416400,
"viewing_times": "540-1080",
}
The response contains similar fields as POST /api/v1/property/new
This is a websocket connection. All communication is done using JSON.
WS /api/v1/property/:id/bid
TODO: DEFINE THIS API