You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functionality to add recipes to a favorited list for a particular user can be done with the following request.
Request:
POST /api/v1/favorites
Content-Type: application/json
Accept: application/json
Send in body (raw, JSON)
{
"api_key": "jgn983hy48thw9begh98h4539h4",
"country": "thailand",
"recipe_link": "https://www.tastingtable.com/.....",
"recipe_title": "Crab Fried Rice (Khaao Pad Bpu)"
}
Response:
{
"success": "Favorite added successfully"
}
Requirements:
This POST endpoint should NOT call your endpoint like /api/v1/favorites?country=thailand,recipe_link="https://www.tastingtable.com/....."&recipe_title="Crab Fried Rice (Khaao Pad Bpu)"&api_key=jgn983hy48thw9begh98h4539h4p. You must send a JSON payload in the body of the request - in Postman, under the address bar, click on “Body”, select “raw”, which will show a dropdown that probably says “Text” in it, choose “JSON” from the list - this is a hard requirement to pass this endpoint!
If the api_key is invalid (no user with that api key), an appropriate 400-level status code should be returned, as well as a message explaining what went wrong.
If the api_key is valid, create a favorite for the user with that api key.
A successful request creates a Favorite for that user in the database, and returns a 201 status code.
Your Favorites Table can store country, recipe_link and recipe_title, as well as a foreign key for user. (One to many relationship between User and Favorites)
Wireframes:
The text was updated successfully, but these errors were encountered:
Adding Recipes to a Favorite List
Functionality to add recipes to a favorited list for a particular user can be done with the following request.
Request:
Response:
Requirements:
- in Postman, under the address bar, click on “Body”, select “raw”, which will show a dropdown that probably says “Text” in it, choose “JSON” from the list
- this is a hard requirement to pass this endpoint!
Wireframes:
The text was updated successfully, but these errors were encountered: