Skip to content

snehamrzn/chef-ai

Repository files navigation

API Documentation

Users API

1. GET /api/users?email={email}

Description: Fetch users info.

  • Request:

    • Method: GET
    • URL: /api/users?email={email}
  • Response:

    • All information about that specific user

2. POST /api/users

Description: Create a new user.

  • Request:

    • Method: POST
    • URL: /api/users
    • Headers: { "Content-Type": "application/json" }
    • Body:
      {
        "email": "[email protected]",
        "name": "jane",
        "allergies": "shrimp,gluten", //optional param
        "dislikes": "mustard,tomato" //optional param
      }
  • Response:

    • Information of new user

3. PUT /api/users

Description: Update a user's allergies & dislikes.

  • Request:

    • Method: PUT
    • URL: /api/users
    • Headers: { "Content-Type": "application/json" }
    • Body:
      {
        "email": "email",
        "name": "jane",
        "allergies": "shrimp,gluten",
        "dislikes": "mustard,tomato"
      }
  • Response:

    • User's information with updated values

    Favorites API

1. GET /api/inventory?email={email_of_user}

Description: Fetch all favorite items of a user.

  • Request:

    • Method: GET
    • URL: /api/favs?email={email_of_user}
  • Response:

    • Status: 200 OK
    • Body:
      [
        {
          "id": "1",
          "recipe": "xyz",
          "name": "Pizza",
          "ingredients": "onion,tomato"
        }
      ]

2. POST /api/favs

Description: Add an item to favorites.

  • Request:

    • Method: POST
    • URL: /api/favs
    • Headers: { "Content-Type": "application/json" }
    • Body:
      {
        "email": "[email protected]",
        "name": "Burger",
        "recipe": "xyz",
        "ingredients": "salt, water"
      }
  • Response:

    • List of all favories of the user

3. DELETE /api/favs?id={id}

Description: Remove one favorite item if id present. Else, remove all favorites of the user.

  • Request:

    • Method: DELETE
    • URL: /api/favs?id={id} id is optional, removes all if id not present
    • Body:
      {
        "email": "[email protected]"
      }
  • Response:

    • All the favorite recipes of the user.

inventory API

1. GET /api/inventory?email={email_of_user}

Description: Fetch inventory of a user.

  • Request:

    • Method: GET
    • URL: /api/inventory?email={email_of_user}
  • Response:

    • Status: 200 OK
    • Body:
      [
        {
          "id": "1",
          "email": "[email protected]",
          "details": "allergic to..."
        }
      ]

2. POST /api/inventory

Description: Add an user's details to inventory

  • Request:

    • Method: POST
    • URL: /api/inventory
    • Headers: { "Content-Type": "application/json" }
    • Body:
      {
        "email": "[email protected]",
        "details": "somehting...."
      }
  • Response:

    • List info of the user

3. DELETE /api/inventory?id={id}

Description: Remove an inventory item by its id. If no id is provided, it removes all inventory items for the user.

  • Request:

    • Method: DELETE
    • URL: /api/inventory?id={id} id is optional, removes all if id not present
    • Body:
      {
        "email": "[email protected]"
      }
  • Response:

    • All the favorite recipies of the user.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5