Pickup options
List timeslots for Delivery
GET api.foodin.ai/users/{user_id}/service_options/cart/pickupLists the available pickup service options for the customer's location and cart items. In this context, service options are time slots, such as Within 5 hours or Friday 9am-11am. Availability is based on current and anticipated deliverer availability for the relevant store location. The list includes immediate and scheduled time slots.
After a time slot is selected, save the service_option_id. You specify the ID when reserving the time slot.
Parameters
| Field | Type | Description |
|---|---|---|
| user_id | string | The ID of the user. |
Request
| Field | Type | Description |
|---|---|---|
| Items | Array(items) | The items for delivery. |
| location_code | string | The location code of the store fulfilling the order. |
| with_eta_options | boolean | Returns ETA options instead of immediate when true. Defaults to false. |
Items Object
| Field | Type | Description |
|---|---|---|
| line_num | String | The item's line number in the order. |
| count | Integer | The count of the item. Must be a non-negative integer. |
| weight | number | The weight of the item (defaults to kg in the US). Must be a non-negative number. |
| special_instructions | string | Any special instructions about the item selection. |
| replacement_policy | string | One of "no_replacements", "users_choice" (default if replacement_items specified), or "deliverers_choice" (default otherwise). |
| replacement_items | Array | A list of requested replacement items if the original item could not be found. This field needs to be turned on via configuration. |
| item | Object | The item's code. |
Replacement_items Object
| Field | Type | Description |
|---|---|---|
| upc | string | The item's universal product code (upc). |
Item Object
| Field | Type | Description |
|---|---|---|
| upc | string | The item's universal product code (upc). |
Request examples
var request = require("request");
var options = {
method: "POST",
url: "https://api.foodin.ai/users/{user_id}/service_options/cart/pickup",
headers: {
Accept: "application/json",
Authorization: "Bearer <token>",
"Content-Type": "application/json",
},
body: {
items: [
{
line_num: "string",
count: 1,
weight: 1,
special_instructions: "string",
replacement_policy: "no_replacements",
replacement_items: [
{
upc: "string",
},
],
item: {
upc: "string",
},
},
],
location_code: "string",
with_eta_options: true,
},
json: true,
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});Response
| Field | Type | Description |
|---|---|---|
| service_options | Array | The item's line number in the order. |
| warnings | Integer | The count of the item. Must be a non-negative integer. |
| flags | Object | Additional properties of the address. |
Service_options Object
| Field | Type | Description |
|---|---|---|
| id | integer | The ID of the service option. |
| service_option_reference | String | The reference of the service option. |
| date | String | The date the service will take place in ISO 8601 format. |
| handoff_time | String | The ETA for deliverer to arrive at store. |
| Window | Object | The time window when the service will take place. |
| Availability | Object | The availability of this service option. |
Windows Object
| Field | Type | Description |
|---|---|---|
| available | boolean | Indicates if this service option is available for the user. |
| reasons | Array | The reasons for unavailability of a service option. Currently, the reasons are related to the laws governing the sale of alcohol. For example, restrictions on quantity, delivery time, pickup, and matched city and county of stores and customers. The reasons are subject to change without notice. |
| item_codes | Array | The item codes which caused the option to be unavailable. |
Availability Object
| Field | Type | Description |
|---|---|---|
| start_at | string | The start of the delivery window in ISO 8601 format. |
| end_at | string | The end of the delivery window in ISO 8601 format. |
| type | string | The type of service option. One of 'scheduled', 'eta' or 'asap’. |
| asap | boolean | Indicates if delivery will happen as soon as possible. Only true when type is asap. |
Reasons for unavailability of a service option
| Reason | Description |
|---|---|
State law restricts amount of {beer/wine/spirits} to {#} fl oz, cart quantity is: {#} fl oz. | The quantity of this alcohol type exceeds the country/state law limit.. |
| Error validating alcohol quantities. Please try again. | The quantity of alcohol can’t be validated. |
| Unmatched city and county | The city and county of the store and customer must match. |
| Unfortunately alcohol pickup is not available at this location. Please remove alcohol from your basket or try delivery. | Alcohol pickup is not available at this location. |
Response examples
{
"service_options": [
{
"id": 210,
"service_option_reference": "ezppZD0-MjEwLCA6dHlwZT0-IlBpY2t1cE9wdGlvbiIsIDp3aW5kb3c9PjxJbnN0YWNhcnQ6OkVudGVycHJpc2U6OkJvYmE6OkNvcmU6OlR5cGVzOjpWMTo6U2VydmljZU9wdGlvblNjaGVkdWxlZFdpbmRvdzogZGVzY3JpcHRvcjogIiIsIHN0YXJ0X2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjU3NjAwLCBuYW5vczogMD4sIGVuZF9hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-Pn0=",
"date": "2022-02-22",
"window": {
"start_at": "2022-02-22T00:00:00Z",
"end_at": "2022-02-22T02:00:00Z",
"type": "scheduled",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
},
{
"id": 211,
"service_option_reference": "ezppZD0-MjExLCA6dHlwZT0-IlBpY2t1cEV0YU9wdGlvbiIsIDp3aW5kb3c9PjxJbnN0YWNhcnQ6OkVudGVycHJpc2U6OkJvYmE6OkNvcmU6OlR5cGVzOjpWMTo6U2VydmljZU9wdGlvblNjaGVkdWxlZFdpbmRvdzogZGVzY3JpcHRvcjogIiIsIGVuZF9hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-Pn0=",
"date": "2022-02-22",
"window": {
"start_at": "2022-02-22T00:00:00Z",
"end_at": "2022-02-22T02:00:00Z",
"type": "eta",
"asap": false
},
"availability": {
"available": true,
"reasons": [],
"item_codes": []
}
}
],
"warnings": []
}4XX Errors
| Code | Cause | Error Message |
|---|---|---|
| 400 | User Not Found | "User Not Found" |
| 400 | Invalid location code | "Specified store is not available for pickup." |
| 400 | Invalid Quantity, expected weight | "One of these items had an invalid quantity amount, 0001234567892 expected weight" |
| 400 | Invalid items | "1 item not found." |
| 403 | User Not Active | "User Not Active" |
| 404 | Resource not found | "Resource not found" |