POST Find complementary items
For each item in the request body, returns an array of complementary items that are available in the selected store. By default, an item can have up to five complementary items.
POST api.foodin.ai/users/{user_id}/complementary_itemsRequest
Method Parameters
| Field | Type | Description |
|---|---|---|
| user_id | string | The ID of the user. |
Request
| Field | Type | Description |
|---|---|---|
| location_code | string | The location code of the store to use for inventory. Complementary items are selected from this store. |
| cart_id | string | The ID of the cart. |
| max_complementary_items | integer | The maximum number of suggested complementary items to be returned. Defaults to 5. |
| items | Array | An array of items. Complementary items are retrieved for each of these items. |
Items object
| Field | Type | Description |
|---|---|---|
| line_num | string | The line number |
| item | Item | The item. |
Item object
| Field | Type | Description |
|---|---|---|
| rrc | string | The item's store reference code (rrc). |
Request example
var request = require("request");
var options = {
method: "POST",
url: "https://api.foodin.ai/users/{user_id}/replacement_items",
headers: {
Accept: "application/json",
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: {
max_replacement_items: 1,
},
json: true,
};Response
200 Success
{
"complementary_items": [
{
"upc": "11111111111111"
}
]
}4XX Errors
Error responses return either a single error or multiple errors.
| Error code | Error Message |
|---|---|
| 400 | Could not find specified store. |
| 400 | User Not Found |