-
Notifications
You must be signed in to change notification settings - Fork 3
Back end API
This API is used to sign up a new user.
-
URL
http:// IP Address:3000/signup -
Method:
POST -
Data Params
{ "username": "sample_username", "email": "sample_email", "password": "sample_password" } -
Response Codes:
-
Success Code: 200
-
Error Codes: 401 UNAUTHORIZED, 400 BAD REQUEST , 404 NOT FOUND
-
-
Sample Call:
curl -H "Content-Type: application/json" -X POST -d '<your json data>' http://127.0.0.1:3000/signup -
Sample Request:
http://192.168.0.14:3000/signup/{ "username":"pallaviraman", "email":"pallaviraman@ufl.edu", "password":"pals" } -
Sample Response:
Signed up
This API is used for logging in an existing user.
-
URL
http:// IP Address:3000/login -
Method:
POST -
Data Params
{ "username" : "sample_username", "password" : "sample_password" } -
Response Codes:
-
Success Code: 200
-
Error Codes: 401 UNAUTHORIZED, 400 BAD REQUEST, 404 NOT FOUND
-
-
Sample Call:
curl -H "Content-Type: application/json" -X POST -d '<your json data>' http://127.0.0.1:3000/login -
Sample Request:
http://192.168.0.14:3000/login/{ "username":"pallaviraman", "password":"pals" } -
Sample Response:
Logged in
This API is used to post about a new apartment.
-
URL
http:// IP Address:3000/lease -
Method:
POST -
Data Params
{ "title": "sample apartment", "owner": "saptarshi", "email": "ssaptarshii@ufl.edu", "location": "gainesville, Florida, USA", "zipcode": 32608, "description": "brief description about the apartment", "rent" : 500, "geolocation" : { "lat" : 40.12, "lon" : -71.34 }, "startdate":"2017-11", "enddate" : "2018-05", "images" : [array of images], "bathrooms": 1, "bedrooms": 2, "roomtype": "private room" "internet": false, "airconditioning": true, "washer_dryer": true, "free_parking_on_premises": true, "wheelchair_accessible": true, "pool": true, "gym": true, } -
Response Codes
-
Success Code: 200
- Error Codes: 401 UNAUTHORIZED, 400 BAD REQUEST
-
Success Code: 200
-
Sample Call:
curl -H "Content-Type: application/json" -X POST -d '<your json data>' http://127.0.0.1:3000/lease -
Sample Request:
http://192.168.0.14:3000/lease/ -
Sample Response:
{ "_index": "housing", "_type": "leasemetadata", "_id": "5a25cbad0e5c472792a0f84f000008", "_version": 1, "result": "created", "_shards": { "total": 2, "successful": 1, "failed": 0 }, "created": true }
This API is used to get all the listings information present in the DB.
-
URL
http:// IP Address:3000/lease -
Method:
GET -
Success Response: 200
-
Error Response: 401 UNAUTHORIZED, 404 NOT FOUND
-
Sample Call:
curl http://127.0.0.1:3000/lease -
Sample Request:
http://192.168.0.14:3000/lease/ -
Sample Response:
{ { "_index": "housing", "_type": "leasemetadata", "_id": "5a24a6160c25092792a0905c000003", "_score": 1, "_source": { "owner": "DilipKunderu", "email": "dilipkvsr@ufl.edu", "title": "testing123", "zipcode": "sdfvsd", "description": "fvjsf", "rent": "44", "geolocation": { "lat": "29.7596087873038", "lon": "-82.0623779296875" }, "startdate": "2017-11", "enddate": "2017-11", "images": [ "image-5a24a61608cd302792a0905c000002.png" ], "roomtype": "Apartment", "bathrooms": "4", "bedrooms": "4", "internet": "1", "airconditioning": "0", "washer_dryer": "1", "private_bathroom": "0", "wheelchair_accessible": "0", "pool": "1", "gym": "0" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a24a34b0cb4ab2792a0d063000006", "_score": 1, "_source": { "owner": "DilipKunderu", "email": "dilipkvsr@ufl.edu", "title": "Dkuntest01", "zipcode": "14e123", "description": "hogjsdogv", "rent": "900", "geolocation": { "lat": "30.159376896356193", "lon": "-82.3586654663086" }, "startdate": "2017-11", "enddate": "2017-11", "images": [ "image-5a24a34a03f8512792a0d063000005.png" ], "roomtype": "Shared room", "bathrooms": "3", "bedrooms": "4", "internet": "1", "airconditioning": "0", "washer_dryer": "1", "private_bathroom": "0", "wheelchair_accessible": "0", "pool": "0", "gym": "1" } } }```
This API is used to get a specific listing information, if it is present in the DB corresponding to a particular id.
-
URL
http:// IP Address:3000/get_id?id=some id -
Method:
GET -
URL Params
id -
Response Codes:
-
Success Code: 200
-
Error Code: 404 NOT FOUND
-
-
Sample Call:
curl http://127.0.0.1:3000/get_id?id=12345cf234 -
Sample Request:
http://192.168.0.14:3000/get_id?id=5a25cbad0e5c472792a0f84f000008 -
Sample Response:
{ "_index": "housing", "_type": "leasemetadata", "_id": "5a25cbad0e5c472792a0f84f000008", "_version": 1, "found": true, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }
This API is used to get listing information specific to the user.
-
URL
http:// IP Address:3000/mylease?name=some_name -
Method:
GET -
URL Params
id -
Response Codes:
-
Success Code: 200
-
Error Code: 404 NOT FOUND
-
-
Sample Call:
curl http://127.0.0.1:3000/mylease?name=some_name -
Sample Request:
http://192.168.0.14:3000/mylease?name= sapt -
Sample Response:
{ "_index": "housing", "_type": "leasemetadata", "_id": "5a12399504d7bf2792a09814000005", "_score": 1.3862944, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a12399504a0b02792a09814000004.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a149a400dca3f2792a0404e000003", "_score": 1.3862944, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a149a400d88b52792a0404e000002.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }
This API is used to delete the listing present in the DB corresponding to a particular id.
-
URL
http:// IP Address:3000/delete_id?id=someid" -
Method:
DELETE -
URL Params
id -
Response Codes:
-
Success Code: 200
-
Error Code: 404 NOT FOUND
-
-
Sample Call:
curl -X "DELETE" http://127.0.0.1:3000/delete_id?id=12334cf2 -
Sample Request:
http://192.168.0.14:3000/delete_id?id=5a25cbad0e5c472792a0f84f000008 -
Sample Response:
Deleted
This API is used to get lease data between two dates.
-
URL
http:// IP Address:3000/dateSample URL:
http://localhost:3000/date?min=2017-10&max=2018-05 -
Method:
GET -
URL Params
min date, max date -
Data Params
None -
Response Codes:
-
Success Code: 200
-
Error Code: 404 NOT FOUND
-
-
Sample Call:
curl http://127.0.0.1:3000/date?min=2017-10&max=2018-05 -
Sample Request:
http://192.168.0.14:3000/date?min=2017-10&max=2018-05 -
Sample Response:
{ "_index": "housing", "_type": "leasemetadata", "_id": "5a2461d00088f72792a0100a000005", "_score": 2, "_source": { "owner": "Saptarshi", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a2461d0000bfa2792a0100a000004.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a24625807b51c2792a0100a000007", "_score": 2, "_source": { "owner": "Saptarshi", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a2462580747d22792a0100a000006.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a12399504d7bf2792a09814000005", "_score": 2, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a12399504a0b02792a09814000004.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a149a400dca3f2792a0404e000003", "_score": 2, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a149a400d88b52792a0404e000002.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }
This API is used to get lease data with rent ranging between minimum and the maximum price value given.
-
URL
http:// IP Address:3000/priceSample URL:
http://localhost:3000/price?min=500&max=600 -
Method:
GET -
URL Params
min price, max price -
Data Params
None -
Response Codes:
-
Success Code: 200
-
Error Code: 404 NOT FOUND
-
-
Sample Call:
curl http://127.0.0.1:3000/price?min=400&max=1000 -
Sample Request:
http://localhost:3000/price?min=500&max=600 -
Sample Response:
{ "_index": "housing", "_type": "leasemetadata", "_id": "5a2461d00088f72792a0100a000005", "_score": 1, "_source": { "owner": "Saptarshi", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a2461d0000bfa2792a0100a000004.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a24625807b51c2792a0100a000007", "_score": 1, "_source": { "owner": "Saptarshi", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a2462580747d22792a0100a000006.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a12399504d7bf2792a09814000005", "_score": 1, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a12399504a0b02792a09814000004.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }, { "_index": "housing", "_type": "leasemetadata", "_id": "5a149a400dca3f2792a0404e000003", "_score": 1, "_source": { "owner": "sapt", "email": "ssaptarshii@ufl.edu", "title": "first lease house", "zipcode": "32608", "description": "new house in midtown", "rent": "502", "geolocation": { "lat": "40", "lon": "79" }, "startdate": "2017-10", "enddate": "2018-05", "images": [ "image-5a149a400d88b52792a0404e000002.jpg" ], "roomtype": "Studio", "bathrooms": "3", "bedrooms": "3", "internet": "true", "airconditioning": "true", "washer_dryer": "false", "private_bathroom": "true", "wheelchair_accessible": "true", "pool": "false", "gym": "false" } }
This API is used to send email to the owner.
-
URL
http:// IP Address:3000/sendemail -
Method:
POST -
Data Params
{ "to": "recipient_emailid", "subject": "email_subject", "text": "email_content" } -
Response Code:
-
Success Code: 200
-
Error Codes: 401 UNAUTHORIZED, 400 BAD REQUEST, 404 NOT FOUND
-
-
Sample Call:
curl -H "Content-Type: application/json" -X POST -d '<your json data> http://127.0.0.1:3000/sendemail -
Sample Request:
http://192.168.0.14:3000/sendemail/{ "to":"pallaviraman@ufl.edu", "subject":"Lease request", "text":"Need more details,ssaptarshii@ufl.edu" } -
Sample Response:
Message sent