Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Happy Path: Endpoint #4 Add Favorites - POST /api/v1/favorites #6

Open
ajpulzone opened this issue Jan 17, 2023 · 1 comment
Open
Assignees
Labels
good first issue Good for newcomers

Comments

@ajpulzone
Copy link
Owner

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:

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:

Image

@ajpulzone ajpulzone self-assigned this Jan 17, 2023
@ajpulzone ajpulzone converted this from a draft issue Jan 17, 2023
@ajpulzone ajpulzone moved this from Todo to In Progress in Lunch and Learn Project Board Jan 17, 2023
@ajpulzone
Copy link
Owner Author

1/16/23 8:30pm

Working in postman, but testing is HIGHLY inadequate.

However, response in postman is what we expect. AJP

@ajpulzone ajpulzone added the good first issue Good for newcomers label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Development

No branches or pull requests

1 participant