API endpoints
The widget communicates with the backend via the following endpoints
GET /settings
GET /settingsRetrieves the account settings and configuration for the widget.
Status Codes:
200 OK: Success.
Parameters:
locale(string): The current locale (e.g., "en").include_restaurants(boolean): Whether to include restaurant data (default: false).
Response:
{
"is_test_mode": false,
"pickup_restaurants_count": 5,
"delivery_restaurants_count": 3,
"pickup_restaurants": [
{
"id": 1,
"name": "Downtown Branch",
"address_line_1": "123 Main St",
"city": "New York",
"region": "NY",
"is_pickup_enabled": true,
"is_delivery_enabled": false
}
],
"delivery_restaurants": [
{
"id": 2,
"name": "Uptown Branch",
"address_line_1": "456 Broadway",
"city": "New York",
"region": "NY",
"is_pickup_enabled": true,
"is_delivery_enabled": true
}
],
"settings": {
"base_country": "United States",
"advanced": {
"show_restaurant_name": true,
"show_restaurant_address": true,
"address_format": "{address_line_1}, {city}",
"always_show_order_note": false
},
"google": {
"maps_api_key": "AIzaSy...",
"enable_widget_map": true
},
"widget": {
"google": {
"maps_api_key": "AIzaSy...",
"enable_widget_map": true
},
"advanced": {
"show_restaurant_name": true,
"show_restaurant_address": true,
"address_format": "{address_line_1}, {city}",
"always_show_order_note": false
},
"restaurant": {
"select_delivery_location": true,
"adjust_location_with_map": true
},
"location_types": {
"sort_by_type": true
}
},
"company_name": "My Store",
"language": "en",
"currency_code": "USD",
"country_code": "US",
"time_format": "12h",
"developer": {
"selectors": {
"product_add_to_cart": "form[action='/cart/add']",
"product_add_to_cart_text": ".add-to-cart-text"
}
},
"checkout_locales": {
"pickup": "en",
"delivery": "en",
"shipping": "en"
}
},
"translations": [
{
"id": 1,
"translation_key": "front_widget",
"values": {
"en": "Order Now",
"es": "Ordenar Ahora"
}
}
]
}POST /product-options
POST /product-optionsRetrieves available product options for a given product, used for checking availability and restrictions.
Status Codes:
200 OK: Success.400 Bad Request: Missing product data.404 Not Found: Shop or account not found.
Payload:
{
"shop": "my-shop.myshopify.com",
"product": {
"id": 1234567890,
"variants": [
{
"id": 9876543210,
"title": "Small",
"price": "10.00"
}
],
"type": "Food",
"vendor": "My Vendor",
"tags": ["tag1", "tag2", "gluten-free"]
}
}Response:
{
"data": {
"options": [
{
"id": 1,
"name": "Size",
"is_required": 1,
"help_text": "Choose a size",
"max_selections": 1,
"min_selections": 1,
"values": [
{ "id": 1, "value": "Small" },
{ "id": 2, "value": "Large" }
]
},
{
"id": 2,
"name": "Toppings",
"is_required": 0,
"help_text": "Add extra toppings",
"max_selections": 3,
"min_selections": 0,
"values": [
{ "id": 3, "value": "Cheese" },
{ "id": 4, "value": "Pepperoni" },
{ "id": 5, "value": "Mushrooms" }
]
}
]
}
}
POST /search
POST /searchSearches for available restaurants based on location and delivery option.
Status Codes:
200 OK: Success.
Payload:
{
"deliveryOption": "pickup", // or "delivery"
"query": "10001",
"latitude": 40.7128,
"longitude": -74.0060,
"page": 1,
"requestTime": "2023-10-25T12:00:00",
"postcode": "10001"
}Response:
{
"data": [
{
"id": 1,
"name": "Downtown Store",
"distance": 1.2,
"status": "open",
"full_address": "123 Main St, New York, NY 10001",
"address_line_1": "123 Main St",
"city": "New York",
"region": "NY",
"country_code": "US",
"menus": [
{
"id": 1,
"name": { "en": "Lunch Menu" },
"status": "published"
}
],
"restaurant_type": {
"id": 1,
"name": "Italian"
},
"config": {
"delivery_options": {
"store_pickup": { "enabled": true },
"local_delivery": { "enabled": false }
}
}
}
],
"meta": {
"current_page": 1,
"from": 1,
"last_page": 5,
"per_page": 5,
"to": 5,
"total": 25
},
"account_status": "active",
"all_restaurants_closed": false,
"count": true,
"distance_unit": "km",
"has_more_pages": true
}POST /checkouts
POST /checkoutsCreates a draft order or processes the checkout.
Status Codes:
200 OK: Success.422 Unprocessable Entity: Validation errors (e.g., out of stock).
Payload:
{
"restaurant_id": 123,
"menu_id": 456,
"zone_id": 789, // Required for delivery if zones are used
"store_url": "my-shop.myshopify.com",
"checkout_method": "pickup", // or "delivery"
"date": "2023-10-25",
"time": "14:00",
"start_time": "14:00", // Optional, for slots
"end_time": "15:00", // Optional, for slots
"slot_id": 101, // Optional, specific slot ID
"note": "Leave at door",
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+15551234567",
"customer_id": "987654321", // Optional Shopify Customer ID
"locale": "en",
"line_items": [
{
"id": 11223344, // Variant ID
"quantity": 2,
"properties": {
"_ZapietId": "M=P&D=2023-10-25&T=14:00",
"Custom Option": "Value"
}
}
],
"customer_address": {
"formatted_address": "123 Main St, New York, NY 10001, USA",
"postcode": "10001",
"city": "New York",
"province_code": "NY",
"country_code": "US",
"country": "United States"
},
"attributes": [
{
"key": "Checkout-Method",
"value": "pickup"
},
{
"key": "Pickup-Date",
"value": "2023-10-25"
},
{
"key": "Pickup-Time",
"value": "14:00"
}
]
}Success Response (200 Ok):
{
"url": "https://my-shop.myshopify.com/6324234/checkouts/0123456789abcdef0123456789abcdef"
}Error Response (422 Unprocessable Entity):
{
"errors": [
{
"field": ["line_items"],
"message": "Some items are out of stock"
}
]
}GET /restaurant/{restaurant}/menu/{menu}
GET /restaurant/{restaurant}/menu/{menu}Retrieves the details of a specific menu for a restaurant.
Status Codes:
200 OK: Success.404 Not Found: Restaurant or menu not found.
Parameters:
restaurant(integer): The restaurant ID.menu(integer): The menu ID.
Response:
{
"data": {
"id": 1,
"name": "Lunch Menu",
"menu_sections": [
{
"id": 1,
"name": "Starters",
"sort_order": 1,
"menu_section_items": [
{
"id": 101,
"sort_order": 1,
"product": {
"id": 501,
"name": "Garlic Bread",
"title": "Garlic Bread",
"variant_name": "Regular",
"image_url": "https://example.com/garlic-bread.jpg",
"variant_id": "1234567890",
"product_id": "9876543210",
"daily_limit": 50,
"orderCount": {
"variant_id": 1234567890,
"remaining": 45
},
"config": {
"preparation_time": 15,
"allergens": [
{ "id": 1, "name": { "en": "Gluten" } }
],
"dietry_restrictions": [
{ "id": 1, "name": { "en": "Vegetarian" } }
]
},
"variants": [
{
"id": 1234567890,
"limit": 50,
"title": "Regular"
}
]
}
}
]
}
]
}
}
Last updated