Product API
Pantry
Overview

Pantry

After users create a successful purchase, you have the ability to integrate a Pantry in your user Account. In the next section we will provide you with templates, endpoints and error codes for Pantry.

GET Retrieve a list of items that the user has purchased

GET api.foodin.ai/users/{userId}/pantry/all

Request

Parameters

FieldParameterDescription
pantryObjectRetrieve a an object with all items that the user has purchased

Response

200 Success

{
  "user_id": 2531124,
  "pantry_id": 4589340,
  "pantry_items": [
    {
      "product_id": 1,
      "upc": "01111041600",
      "name": "Kroger 2% Reduced Fat Milk",
      "quantity": "5",
      "expiration_date": "2022-02-30",
      "purchase_date": "2022-01-15",
      "store": "FoodsCo",
      "brand": "Kroger",
      "size": "1",
      "unit": "liter",
      "grocery": {
        "grocery_id": 49817,
        "category": "Dairy",
        "subcategory": "Milk"
      },
      "allergens": ["Dairy"]
    },
    {
      "product_id": 2,
      "upc": "01111214574",
      "name": "Pineapple",
      "quantity": "1",
      "expiration_date": "2022-02-01",
      "purchase_date": "2022-01-15",
      "store": "FoodsCo",
      "brand": "FoodsCo",
      "size": "1",
      "unit": "each",
      "grocery": {
        "grocery_id": 51244,
        "category": "Fruit",
        "subcategory": "Pineapple"
      },
      "allergens": ["pineapple"]
    }
  ]
}

4XX Responses

FieldDescription
400 Bad RequestThe request body is missing required fields or contains invalid data.
404 Not FoundThe pantry item with the specified ID cannot be found.
500 Internal Server ErrorAn unexpected error occurred while trying to retrievee the pantry item

PUT Update a specific product in the pantry by its id or UPC code

PUT api.foodin.ai/users/{user_id}/pantry/{product_id}

Request

FieldParameterDescription
nameStringUpdate a specific product in the pantry by its id or upc code
quantityIntegerNumber of quantity of the product

Response

{
  "name": "Product Name",
  "quantity": -2
}

4XX Responses

FieldDescription
400 Bad RequestThe request body is missing required fields or contains invalid data.
401 UnauthorizedThe user_id doesn’t exit in the database
404 Not FoundThe pantry item with the specified ID cannot be found.
500 Internal Server ErrorAn unexpected error occurred while trying to update the pantry item