POST Reccomendation items
POST api.foodin.ai/users/{user_id}/replacement_itemsFor 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
| Field | Type | Description |
|---|---|---|
| user_id | string | The ID of the user. |
Requests
| Field | Parameter | Description |
|---|---|---|
| location_code | string | The location code of the store to use for inventory. Replacement items are selected from this store. |
| cart_id | string | The ID of the cart. |
| max_replacement_items | integer | The maximum number of suggested replacement items to be returned for each item. Defaults to 5. |
| items | Array | An array of items. Replacement items are retrieved for each of these items. |
Items Object
| Field | Type | Description |
|---|---|---|
| upc | string | The 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
| Field | Type | Description |
|---|---|---|
| items | Array | The items and their suggested replacement items. |
Items object
| Field | Type | Description |
|---|---|---|
| line_num | string | The line number |
| item | Item | The item. |
| replacement_items | Array | The suggested replacement items. |
Item object
| Field | Type | Description |
|---|---|---|
| upc | string | The item's universal product code (upc). |
| rrc | string | The item's store reference code (rrc). |
| stock_level | string | The stock level of the item. One of IN_STOCK, LOW_STOCK, or OUT_OF_STOCK. |
Replacement_items object
| Field | Type | Description |
|---|---|---|
| upc | string | The item's universal product code (upc). |
| rrc | string | The item's store reference code (rrc). |
| stock_level | string | The 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 Code | Error Message |
|---|---|
| 400 | Could not find specified store. |
| 400 | User Not Found |
| stock_level | The stock level of the item. One of IN_STOCK, LOW_STOCK, or OUT_OF_STOCK. |