Product API
Fulfillment guide
Recommendation
POST Reccomendation Items from order

POST Reccomendation items from order

For each item in an order, 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

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

Request

Method Parameters

FieldTypeDescription
order_idStringThe ID of the order
user_idstringThe ID of the user.

Request parameters

FieldTypeDescription
max_replacement_itemsintegerThe maximum number of suggested replacement items to be returned for each item. Defaults to 5.

Request example

var request = require("request");
 
var options = {
  method: "POST",
  url: "https://api.foodin.ai/users/{user_id}/orders/{order_id}/replacement_items",
  headers: {
    Accept: "application/json",
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  },
  body: {
    max_replacement_items: 1,
  },
  json: true,
};

Items array

FieldTypeDescription
itemsArrayThe items and their 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

200 Success

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

4XX Errors

Error responses return either a single error or multiple errors.

Error codeError Message
400Could not find specified store.
400User Not Found