Product API
Fulfillment guide
Recommendation
POST Reccomendation Items

POST Reccomendation items

POST api.foodin.ai/users/{user_id}/replacement_items

For each item in the request body, returns an array of suggested replacement items that are available in the selected store. By default, an item can have up to five replacement items.

Request

Parameters

FieldTypeDescription
user_idstringThe ID of the user.

Requests

FieldParameterDescription
location_codestringThe location code of the store to use for inventory. Replacement items are selected from this store.
cart_idstringThe ID of the cart.
max_replacement_itemsintegerThe maximum number of suggested replacement items to be returned for each item. Defaults to 5.
itemsArrayAn array of items. Replacement items are retrieved for each of these items.

Items Object

FieldTypeDescription
upcstringThe item's universal product code (upc)
const request = require("request");
 
const options = {
  method: "POST",
  url: "https://api.foodin.ai/recommendations/users/{user_id}/replacement_items",
  headers: {
    Accept: "application/json",
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  },
  body: {
    location_code: "string",
    cart_id: "string",
    max_replacement_items: 1,
    items: [
      {
        line_num: "string",
        item: {
          rrc: "string",
        },
      },
    ],
  },
  json: true,
};
 
request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});

Success Response 200

FieldTypeDescription
itemsArrayThe items and their suggested replacement items.

Items object

FieldTypeDescription
line_numstringThe line number
itemItemThe item.
replacement_itemsArrayThe suggested replacement items.

Item object

FieldTypeDescription
upcstringThe item's universal product code (upc).
rrcstringThe item's store reference code (rrc).
stock_levelstringThe stock level of the item. One of IN_STOCK, LOW_STOCK, or OUT_OF_STOCK.

Replacement_items object

FieldTypeDescription
upcstringThe item's universal product code (upc).
rrcstringThe item's store reference code (rrc).
stock_levelstringThe stock level of the item. One of IN_STOCK, LOW_STOCK, or OUT_OF_STOCK.

Response

Response examples

200 Success
{
  "items": [
    {
      "line_num": "1",
      "item": {
        "upc": "01111041600",
        "stock_level": "in_stock"
      },
      "replacement_items": [
        {
          "upc": "01111223440",
          "stock_level": "in_stock"
        }
      ]
    }
  ]
}

4XX Errors

HTTP CodeError Message
400Could not find specified store.
400User Not Found
stock_levelThe stock level of the item. One of IN_STOCK, LOW_STOCK, or OUT_OF_STOCK.