Names: Jessica Feng (jyf5), Winnie Chow (wc459)
Date: 5/8/2020
Github Repo: https://github.com/winniechow0617/final-backend
Public server IP: http://34.75.155.213/
Project Overview: This application allows users to create recipes, as well as to add ingredients and reviews to the recipes.
GET /api/recipes/
Response { "success": true, "data": [ { "id": 1, "name": "Scrambled eggs", "instructions": "Beat eggs, milk, salt and pour into frying pen." "time": 20, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...], "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] }, { "id": 2, "name": "Sushi", "instructions": "Spread the seaweed with a layer of rice." "time": 30, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...] "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] } ... ] }
POST /api/recipes/
Request { "name": <USER INPUT>, "instructions": <USER INPUT>, "time": <USER INPUT>, } Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT>, "instructions": <USER INPUT>, "time": <USER INPUT>, "ingredients": [], "reviews": [] } }
GET /api/recipes/{id}/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "instructions": <USER INPUT FOR INSTRUCTIONS>, "time": <USER INPUT FOR TIME>, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...] "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] } }
DELETE /api/recipes/{id}/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "instructions": <USER INPUT FOR INSTRUCTIONS>, "time": <USER INPUT FOR TIME>, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...] "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] } }
POST /api/recipes/{id}/
Request { "name": <USER INPUT>, "instructions": <USER INPUT>, "time": <USER INPUT>, } Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT>, "instructions": <USER INPUT>, "time": <USER INPUT>, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...] "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] } }
GET /api/ingredients/
Response { "success": true, "data": [ { "id": 1, "name": "Egg", "recipes": [<SERIALIZED RECIPE WITHOUT INGREDIENT FIELD>, ...] }, { "id": 2, "name": "Chicken", "recipes": [<SERIALIZED RECIPE WITHOUT INGREDIENT FIELD>, ...] } ... ] }
POST /api/ingredients/
Request { "name": <USER INPUT>, } Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT>, "recipes": [] } }
GET /api/ingredients/{id}/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "recipes": [<SERIALIZED RECIPE WITHOUT INGREDIENT FIELD>, ...] } }
POST /api/recipes/{id}/ingredients/add/
Request { "ingredient_id": <USER INPUT>, } Response { "success": true, "data": <SERIALIZED RECIPE> } }
DELETE /api/recipes/{id}/ingredients/drop/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "recipes": [<SERIALIZED RECIPE WITHOUT INGREDIENT FIELD>, ...] } }
POST /api/recipes/{id}/review/
Request { "name": <USER INPUT>, "rating": <USER INPUT> } Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "rating": <USER INPUT FOR REGION>, "recipe": <RECIPE> } }
GET /api/reviews/{id}/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "rating": <USER INPUT FOR REGION>, "recipe": <RECIPE> } }
DELETE /api/reviews/{id}/
Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "instructions": <USER INPUT FOR INSTRUCTIONS>, "time": <USER INPUT FOR TIME>, "ingredients": [<SERIALIZED INGREDIENT WITHOUT RECEIPT FIELD>, ...] "reviews": [<SERIALIZED REVIEW WITHOUT RECEIPT FIELD>, ...] } }
POST /api/reviews/{id}/
Request { "name": <USER INPUT>, "rating": <USER INPUT> } Response { "success": true, "data": { "id": <ID>, "name": <USER INPUT FOR NAME>, "rating": <USER INPUT FOR REGION>, "recipe": <RECIPE> } }