Backend for posting/deleting/editing listings.
âžť SQLAlchemy - The ORM used
âžť Flask - Web framework
âžť Docker - Containerization
âžť Google Cloud - Server hosting
âžť Yanlam Ko
âžť Jack Thompson
See iOS repo here.
See spec with Dropbox.
- GET all users:
/api/users/
- GET user by user_id:
/api/user/<user_id>/
- POST user:
/api/users/
- DELETE user by user_id:
/api/user/<user_id>/
{
"success": True,
"data": [ <USERS> ]
}
{
"success": True,
"data": {
"id": 0,
"name": "Jack",
"drafts": [ <DRAFTED LISTINGS> ],
"listings": [ <LISTINGS> ],
"collections": [ <COLLECTIONS> ]
}
}
{
"name": "Jack"
}
{
"success": True,
"data": {
"id": 0,
"name": "Jack",
"drafts": [],
"listings": [],
"collections": []
}
}
{
"success": True,
"data": {
"id": 0,
"name": "Jack",
"drafts": [ <DRAFTED LISTINGS> ],
"listings": [ <LISTINGS> ],
"collections": [ <COLLECTIONS> ]
}
}
- GET all listings:
/api/listings/
- GET all listings by user_id:
/api/user/<user_id>/listings/
- GET listing by listing_id:
/api/listing/listing_id>/
- POST listing by user_id:
/api/user/<user_id>/listings/
- POST (edit) listing by listing_id:
/api/listing/<listing_id>/
- DELETE listing by listing_id:
/api/listing/<listing_id>/
{
"success": True,
"data": [ <LISTINGS> ]
}
- includes both published and drafts
{
"success": True,
"data": [ <LISTINGS> ]
}
- includes both published and drafts
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"is_draft": false,
"description": "All new, fully furnished apartment.\n 5 minutes from the engineering quad.",
"rent": 1050,
"address": "717 E. Buffalo Street",
"images": [ <IMAGES> ],
"collections": [ <COLLECTIONS> ]
}
}
- includes both published and drafts
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"is_draft": false,
"description": "All new, fully furnished apartment.\n 5 minutes from the engineering quad.",
"rent": 1050,
"address": "717 E. Buffalo Street",
"images": [ <IMAGES> ],
"collections": [ <COLLECTIONS> ]
}
}
{
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"is_draft": false,
"description": "All new, fully furnished apartment.\n 5 minutes from the engineering quad.",
"rent": 1050,
"address": "717 E. Buffalo Street"
}
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"is_draft": False
"description": "All new, fully furnished apartment.\n 5 minutes from the engineering quad.",
"rent": 1050,
"address": "717 E. Buffalo Street",
"images": [ <IMAGES> ],
"collections": [ <COLLECTIONS> ]
}
}
- (same as Add a listing, but fewer info needed)
{
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"address": "717 E. Buffalo Street",
"is_draft": True
}
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spacious 2BR Apt. in the heart of Collegetown",
"is_draft": True
"description": "",
"rent": -1,
"address": "717 E. Buffalo Street",
"images": [ <IMAGES> ],
"collections": [ <COLLECTIONS> ]
}
}
- (ie. allow to post listing from draft)
{
"title": "New or Old title", #optional
"address": "New or Old address", #optional
"is_draft": False, #optional
"description": "New or Old description", #optional
"rent": 1050, #optional
}
{
"success": True,
"data": {
"id": <listing_id>,
"user_id": <user_id>,
"title": "New or Old title",
"is_draft": True
"description": "New or Old description",
"rent": 1050,
"address": "New or Old address",
"images": [ <IMAGES> ],
"collections": [ <COLLECTIONS> ]
}
}
- GET collections by user_id:
/api/user/<user_id>/collections/
- GET collection by collection_id:
/api/collection/<collection_id>/
- POST collection by user_id:
/api/user/<user_id>/collections/
- DELETE collection by collection_id:
/api/collection/<collection_id>/
- POST listing to collection by collection_id:
/api/collection/<collection_id>
{
"success": True,
"data": [ <COLLECTIONS> ]
}
{
"success": True,
"data": {
"id": 0,
"user": 1,
"title": "Spring 2020",
"listings": [ <LISTINGS> ]
}
}
{
"title": "Spring 2020"
}
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spring 2020",
"listings": []
}
}
{
"success": True,
"data": {
"id": 0,
"user": 1,
"title": "Spring 2020",
"listings": [ <LISTINGS> ]
}
}
{
"listing_id": 0
}
{
"success": True,
"data": {
"id": 0,
"user_id": 1,
"title": "Spring 2020",
"listings": [
{
"id": 0,
"user_id": 1,
"title": "Spacious 2BR Apt. in the heart of Collegetown"
},
...
]
}
}
- GET images by listing_id:
/api/listing/<listing_id>/images/
- GET image by image_id:
/api/image/<image_id>/
- POST image by listing_id:
/api/listing/<listing_id>/images/
- DELETE image by image_id:
/api/image/<image_id>/
{
"success": True,
"data": [
{
"id": 1,
"image": "456789086543456789fghjkkjhgfddfghjk",
"listing_id": 1
}
]
}
{
"success": True,
"data": {
"id": 0,
"image": "AISHLKJNW8\][po3099ipoj33u9ISIDehjh189898 (image as a string)... ",
"listing_id": 1
}
}
{
"image": "AISHLKJNW8\po3099ipoj33u9ISIDehjh189898 (image as a string)... "
}
{
"success": True,
"data": {
"id": 0,
"image": "AISHLKJNW8\po3099ipoj33u9ISIDehjh189898 (image as a string)... ",
"listing_id": 1
}
}
{
"success": True,
"data": {
"id": 0,
"image": "AISHLKJNW8\po3099ipoj33u9ISIDehjh189898 (image as a string)... ",
"listing_id": 1
}
}