NAV Navbar
json graphql shell ruby
  • Introduction
  • Authentication
  • Authorization
  • Restaurants V3 API
  • Orders API
  • Users API
  • Discounts API
  • Restaurants V5 API
  • Carts V5 API
  • Loyalty API
  • Feedback API
  • Errors
  • Introduction

    Welcome to the Zuppler API! You can use our API to access Zuppler API endpoints, which can get information on various users, restaurants, and orders in our database.

    We have language bindings in Shell and Ruby! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

    Authentication

    To authenticate, use this code:

    require 'zuppler'
    
    user = Zuppler::User.authenticate! USER, PASS
    TOKEN = user.access_token
    

    Make sure you replace USER, PASS with your username and password.

    Authorization

    require 'zuppler'
    
    user = Zuppler::User.find TOKEN
    
    # With shell, you can just pass the correct header with each request
    curl "https://users.zuppler.com/users/current" -H "Authorization: Bearer TOKEN"
    # or as query parameter
    curl "https://users.zuppler.com/users/current?access_token=TOKEN"
    

    Make sure to replace TOKEN with your access token.

    Zuppler uses access token to allow access to the API. You can register a new Zuppler account at our Zuppler Identity.

    Zuppler expects for the TOKEN to be included in all API requests to the server in a header that looks like the following:

    Authorization: Bearer TOKEN

    or as query parameter:

    access_token=TOKEN

    Restaurants V3 API

    Get restaurant

    curl "http://restaurants.api.zuppler.com/v3/channels/zuppler/restaurants/demorestaurant.json?access_token=TOKEN"
    
    zr = Zuppler::Restaurant.find PERMALINK
    zr.details
    

    Make sure you replace PERMALINK with your restaurant permalink

    The above command returns the following JSON

    
    

    This endpoint returns restaurant data.

    Http Request

    GET http://restaurants.api.zuppler.com/v3/channels/zuppler/restaurants/PERMALINK.json

    Login user with token

    Request:

      {
        "secret_key": "fasdfaeewfaew345354tg43tegsertthrthjthrt",
        "provider": "punchh"
      }
    

    Response (200):

      {
        "success":true,
        "user":{
          "id":"1f17bc52-194d-438a-a1d6-f442bf0b5716",
          "resource_url":"http://api.biznettechnologies.com/v3/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716.json",
          "logged_in": true,
          "profile":{
            "name": "Silviu Rosu",
            "email": "silviu.rosu@zuppler.com",
            "phone": "01234567890"
          },
          "actions":[
            {
              "action":"zuppler",
              "label":"Zuppler",
              "url":"http://secure.biznettechnologies.com/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/login/accounts?return_to={location}"
            },
            {
              "action":"levelup",
              "label":"Levelup",
              "url":"http://secure.biznettechnologies.com/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/login/levelup?return_to={location}"
            },
            {
              "action":"levelup2",
              "label":"Levelup",
              "url":"http://secure.biznettechnologies.com/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/login/levelup2?return_to={location}"
            }
          ],
          "addresses":{
            "resource_url":"http://api.biznettechnologies.com/v3/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/addresses.json",
            "available":[]
          },
          "routes":[
            {
              "name":"levelup-autologin",
              "path":"/levelup/{userid}/{token}",
              "template_url":"http://levelup.zuppler.com/session/autologin?uid={0}&token={1}&return_url={location}"
            },
            {
              "name":"levelup-login",
              "path":"/login/levelup/",
              "template_url":"http://secure.biznettechnologies.com/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/login/levelup?return_to={location}"
            }
          ],
          "links":[
            {
              "name":"login",
              "methods":["put"],
              "url":"http://api.biznettechnologies.com/v3/channels/demorestaurant/users/1f17bc52-194d-438a-a1d6-f442bf0b5716/login.json"
            }
          ]
        }
      }
    
    

    Response fail (200):

      {
        "success":false,
        "message": "Secret key is not valid"
      }
    
    

    Authenticates a used against a provider using the secret key. If key is valid extract user data and populate shopping user.

    HTTP Request

    POST http://api.zuppler.com/v3/channels/:channel_id/users/:user_id/external_login.json

    Request Parameters

    Parameter Type Required Description
    channel_id string true permalink of the channel
    user_id string true shopping user uuid
    secret_key string true secret key to authenticate with
    provider string true provider to use for authentication

    Orders API

    Search orders

    Request:

    {}
    
    curl "https://orders.api.zuppler.com/v4/orders.json?access_token=TOKEN"
    

    Response:

    {
        "success": true,
        "status": {
            "code": 200,
            "message": "OK"
        },
        "meta": {
            "total": 1,
            "page": 1,
            "count": 1
        },
        "orders": [
            {
                "id": "faf1ff3c-c0b8-11e3-8cc3-22000a98a19e",
                "state": "confirmed",
                "code": "1234",
                "restaurant_name": "Demo Restaurant",
                "customer_name": "John Doe",
                "service_id": "DELIVERY",
                "tender_id": "CASH",
                "time": "2015-05-18T14:24:58+03:00",
                "placed": "2015-05-18T14:24:58+03:00",
                "total": 3942,
                "links": [
                    {
                        "name": "self",
                        "methods": [ "get" ],
                        "url": ""
                    }
                ]
            }
        ],
        "links": []
    }
    

    Search orders based on criteria.

    HTTP Request

    GET /v4/orders.json

    Query Parameters

    Parameter Default Description
    queries[0][field] state field field
    queries[0][op] equal filter operator
    queries[0][value] canceled filter value
    appliesTo all
    sort_by time
    sort_direction desc
    page 1

    Create order

    Request:

    {
        "order": {
            "cart_id": "24efe602-f3ad-11e2-a845-22000a8937d1"
        }
    }
    
    curl -D '{"order": { "cart_id": "aaa1ff4c-aab9-fee3-6e23-22440f98aa9e"}}' "https://orders.api.zuppler.com/v4/orders.json?access_token=TOKEN"
    

    Response 201 (Created):

    {
      "success": true,
      "status": {
        "code": 201,
        "message": "Created"
      },
      "links": [
        {
          "name": "tenders",
          "methods": ["get"],
          "url": "https://orders.api.zuppler.com/v4/orders/5de2ecfc/tenders.json"
        }
      ]
    }
    

    Response 404 (Not found):

    {
        "success": false,
        "status": {
            "code": 404,
            "message": "shopping cart is not found"
        }
    }
    

    Creates new order for given shopping cart.

    HTTP Request

    POST /v4/orders.json

    Request Parameters

    Parameter Type Required Description
    cart_id string true the id of shopping cart

    Tenders

    Request:

    {}
    

    Response:

    {
        "tenders": [
            {
                "id": "cash",
                "label": "Cash",
                "cap": 999,
                "data": {
                  "name": "Cash",
                  "logo_url": "http://www.example.com/logo.gif"
                }
            },
            {
                "id": "card",
                "label": "Credit/Debit Card",
                "cap": 1990,
                "data": {
                   "name": "Braintree",
                   "logo_url": "http://orders.api.zuppler.com/logos/braintree.png",
                   "params": ["name_on_card", "type", "number", "expiration", "cvv"],
                   "bill_as": "Sun Burgers",
                   "cardtypes": ["master", "visa", "american_express", "discover"]
                },
                "vault": {
                    "params": ["vault_id"],
                    "profiles": [
                        {
                            "id": 1, "card_holder": "Test", "card_type": "visa",
                            "card_number": "1234", "expiration_date": "XX/2018"
                        }
                    ]
                }
            },
            {
                "id": "levelup",
                "label": "LevelUp",
                "cap": 1990,
                "data": {
                  "name": "LevelUp",
                  "logo_url": "http://orders.api.zuppler.com/logos/levelup.png",
                  "params": ["email", "password"]
                }
            }
        ],
        "links": [
            {
                "name": "tenders",
                "methods": ["post"],
                "url": "https://orders.api.zuppler.com/v4/orders/5de2ecfc/tenders.json"
            }
        ]
    }
    

    Returns applicable payment tenders for given order.

    HTTP Request

    GET /v4/orders/<ORDER_ID>/tenders.json

    Request Parameters

    Parameter Type Required Description
    order_id string true the id of order

    Create tender

    Request:

    {
        "tender": {
            "id": "LEVELUP",
            "params": {
                "email": "john@example.com",
                "password": "secret"
            }
        }
    }
    
    curl -d '{"tender": {"id": "LEVELUP", "params": {}}}' "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/tenders.json?access_token=TOKEN"
    

    Response 201 (Created):

    {
        "success": true,
        "status": {
            "code": 201,
            "message": "Created"
        },
        "links": [
            {
                "name": "order",
                "methods": ["get"],
                "url": "https://orders.api.zuppler.com/v4/orders/5de2ecfc.json"
            }
        ]
    }
    

    Response 422 (Unprocessable entity):

    {
        "success": false,
        "status": {
            "code": 422,
            "message": "Email or password is invalid"
        },
        "links": [
            {
                "name": "tenders",
                "methods": ["post"],
                "url": "https://orders.api.zuppler.com/v4/orders/5de2ecfc/tenders.json"
            }
        ]
    }
    

    Creates payment tender for given order.

    HTTP Request

    POST /v4/orders/<ORDER_ID>/tenders.json

    Request parameters

    Parameter Type Required Description
    order_id string true the id of order

    Get order

    Request:

    {}
    
    zo = Zuppler::Order.find 'faf1ff3c-c0b8-11e3-8cc3-22000a98a19e'
    zo.details
    
    curl "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e.json?access_token=TOKEN"
    

    Response:

    {
        "success": true,
        "status": {
            "code": 200,
            "message": "OK"
        },
        "order": {
            "id": "faf1ff3c-c0b8-11e3-8cc3-22000a98a19e",
            "code": "6379",
            "carts": [
                {
                    "uuid": "f16c149e-c0b7-11e3-b9d6-1231380c0249",
                    "version": 0,
                    "member": {
                        "name": "John Snow"
                    },
                    "items": [
                    {
                        "id": 2495552,
                        "quantity": 1,
                        "name": "Breakfast Box",
                        "groups": [ ],
                        "menu": "Breakfast Catering",
                        "category": "Breakfast Bar-rito Box",
                        "barcode": null,
                        "alias": "",
                        "price": 6000,
                        "tax": 630,
                        "item_total": 6000,
                        "total": 6000,
                        "comments": null,
                        "resource_url": "",
                        "item_name": "Breakfast Box",
                        "item_id": 103410,
                        "dish_id": 89065,
                        "size_name": null,
                        "priority": 0
                    },
                    {
                        "id": 2495553,
                        "quantity": 1,
                        "name": "Fresh Fruit",
                        "groups": [ ],
                        "menu": "Snack Session (available all day)",
                        "category": "Fresh Fruit",
                        "barcode": null,
                        "alias": null,
                        "price": 3500,
                        "tax": 368,
                        "item_total": 3500,
                        "total": 3500,
                        "comments": null,
                        "resource_url": "",
                        "item_name": "Fresh Fruit",
                        "item_id": 162972,
                        "dish_id": 89066,
                        "size_name": null,
                        "priority": 0
                    },
                    {
                        "id": 2495555,
                        "quantity": 2,
                        "name": "Coffee for 10",
                        "groups": [
                            {
                            "name": "Choice of Milk",
                            "substitution": null,
                            "modifiers": [
                                {
                                    "id": 2432956,
                                    "modifier_id": 172487,
                                    "dish_id": 81470,
                                    "quantity": 2,
                                    "name": "Almond Milk",
                                    "alias": null,
                                    "price": 0,
                                    "tax": 0,
                                    "total": 0,
                                    "priority": 0
                                }
                            ]
                            }
                        ],
                        "menu": "Snack Session (available all day)",
                        "category": "Drinks",
                        "barcode": null,
                        "alias": "",
                        "price": 2500,
                        "tax": 526,
                        "item_total": 5000,
                        "total": 5000,
                        "comments": null,
                        "resource_url": "",
                        "item_name": "Coffee for 10",
                        "item_id": 106260,
                        "dish_id": 81371,
                        "size_name": null,
                        "priority": 0
                    }
                ],
                "discounts": [ ],
                "adjustments": [ ]
                }
            ],
            "tracking": null,
            "resource_url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e.json",
            "placed_at": "2014-04-10T09:04:07-05:00",
            "comments": null,
            "customer": {
                "name": "John Snow",
                "email": "john.snow@example.com",
                "phone": "333-555-7777",
                "address": {
                    "lat": "41.882078",
                    "lng": "-87.636455",
                    "delivery_instructions": "Please call 333-555-7777 in lobby.",
                    "full": "1 main dr., chicago, il 60606 (33rd floor)"
                },
            "resource_url": ""
            },
            "channel": {
                "id": 1,
                "permalink": "zuppler",
                "name": "Zuppler",
                "resource_url": "https://api.zuppler.com/v3/channels/zuppler.json",
                "integration": "proteinbarchicagoloopcatering"
            },
            "restaurant": {
                "id": 683,
                "permalink": "proteinbarchicagoloopcatering",
                "name": "Protein Bar - Chicago Loop Catering",
                "address": {
                    "lat": "41.88306",
                    "lng": "-87.634578",
                    "delivery_instructions": null,
                    "full": "221 W. Washington, Chicago, IL 60606"
                },
                "locale": "en",
                "resource_url": "https://api.zuppler.com/v3/channels/zuppler/restaurants/proteinbarchicagoloopcatering.json"
            },
            "service": {
                "id": "DELIVERY",
                "label": "Delivery",
                "value": {
                    "address": "1 n. wacker dr., chicago, il 60606 (33rd floor)",
                    "instructions": "PLease call 312-525-7674 in lobby."
                }
            },
            "time": {
                "id": "SCHEDULE",
                "label": "Schedule",
                "value": "2014-04-11T08:20:00-05:00",
                "estimation": {
                    "fire": null,
                    "pickup": null,
                    "delivery": null
                }
            },
            "tender": {
                "id": "CARD",
                "label": "Credit Card",
                "value": {
                    "paid": true,
                    "type": "American Express",
                    "last_4_digits": "1003",
                    "as": "Zuppler Food Order"
                }
            },
            "tip": {
                "id": "AMOUNT",
                "label": "Amount",
                "value": 1000
            },
            "settings": {
                "catering": {
                "company": "UBS",
                "event": null,
                "name": "Jessica Martin",
                "phone": "312-525-7674",
                "guests": "15",
                "venue": null
            },
            "extra_fields": [ ]
        },
        "totals": {
        "subtotal": 14500,
        "discount": 0,
        "charges": {
            "delivery": 500,
            "service": 0
        },
        "tax": 1486,
        "tip": 1000,
        "total": 17486
        },
        "rewards": {
            "bucks": 0,
            "points": 0
        },
        "links": [
            {
                "name": "self",
                "methods": ["get"],
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e.json"
            },
            {
                "name": "notifications",
                "methods": ["get"],
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/notifications.json"
            },
            {
                "name": "events",
                "methods": ["get", "post"],
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/events.json"
            },
            {
                "name": "confirm",
                "methods": ["put"],
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/confirm.json"
            },
            {
                "name": "cancel",
                "methods": ["put"],
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/cancel.json"
            },
            {
                "name": "miss",
                "methods": ["put"],
                "interactive": false,
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/miss.json"
            },
            {
                "name": "execute",
                "methods": ["put"],
                "interactive": false,
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/execute.json"
            },
            {
                "name": "touch",
                "methods": ["put"],
                "interactive": false,
                "url": "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e/touch.json"
            }
        ]
        }
    }
    

    Fetches order details

    HTTP Request

    GET /v4/orders/<ID>.json

    URL Parameters

    Parameter Description
    ID The ID of the order to retrieve

    Update order

    Request:

    {
        "order": {
            "favorite": true,
            "metadata": {
                "rds": {
                    "delivery_status": "delivered",
                    "driver_name": "leroy"
                }
            }
        }
    }
    
    curl -X PUT -d '{"order": {"metadata": {"rds": {"driver_name: "leroy""}}}}' "https://orders.api.zuppler.com/v4/orders/faf1ff3c-c0b8-11e3-8cc3-22000a98a19e.json?access_token=TOKEN"
    

    Response:

    {
        "success": true,
        "status": {
            "code": 200,
            "message": "OK"
        }
    }
    
    {
        "success": true,
        "status": {
            "code": 200,
            "message": "OK"
        }
    }
    

    HTTP Request

    PUT /v4/orders/<ID>.json

    URL Parameters

    Parameter Description
    ID The ID of the order to update

    Users API

    Get user

    curl "https://users.zuppler.com/v1/users/current.json?access_token=TOKEN"
    
    user = Zuppler::User.find TOKEN
    user.details
    

    The above command returns the following JSON:

    {
        "success":true,
        "user":{
            "id":62344,
            "name":"John Smith",
            "email":"jsmith@example.com",
            "phone":"6109095204",
            "created_at":"2009-06-18 13:52:00 UTC",
            "roles":["user"],
            "zuppler_bucks":17.88,
            "zuppler_points":5412.0,
            "gravatar_id":"d91103fc35162730d228767e64126911",
            "links":[
                {"name":"self","methods":["get"],"url":"/v1/users/62344.json"},
                {"name":"vaults","method":"get","url":"/v1/users/62344/vaults.json"},
                {"name":"orders","method":"get","url":"/v1/users/62344/orders.json"},
                {"name":"grant","method":"put","url":"/v1/users/62344/grant.json"},
                {"name":"revoke","method":"put","url":"/v1/users/62344/revoke.json"},
                {"name":"providers","method":"get","url":"/v1/users/62344/providers.json"}
            ]
        }
    }
    

    This endpoint returns user's data.

    Http Request

    GET /v1/users/current.json

    Grant user access

    Request:

    {
        "acls": {
            "market": [1]
        }
    }
    
    curl -X PUT -d '{"acls": {"market": [1]}' "https://https://users.zuppler.com/v1/users/1/grant.json?access_token=TOKEN"
    

    Response (200)

    {
        "success":true,
        "user":{
            "id":62344,
            "name":"John Smith",
            "email":"jsmith@example.com",
            "phone":"6109095204",
            "created_at":"2009-06-18 13:52:00 UTC",
            "roles":["user"],
            "zuppler_bucks":17.88,
            "zuppler_points":5412.0,
            "gravatar_id":"d91103fc35162730d228767e64126911",
            "acls": {
                "restaurant_ids": [1, 2, 3],
                "market_ids": [1]
            },
            "links":[
                {"name":"self","methods":["get"],"url":"/v1/users/62344.json"},
                {"name":"vaults","method":"get","url":"/v1/users/62344/vaults.json"},
                {"name":"orders","method":"get","url":"/v1/users/62344/orders.json"},
                {"name":"grant","method":"put","url":"/v1/users/62344/grant.json"},
                {"name":"revoke","method":"put","url":"/v1/users/62344/revoke.json"},
                {"name":"providers","method":"get","url":"/v1/users/62344/providers.json"}
            ]
        }
    }
    

    Response (401)

    {
        "success":false,
        "status": {
            "code": 401,
            "message": "Unauthorized to update access"
        }
    }
    

    Response (400)

    {
        "success":false,
        "status": {
            "code": 400,
            "message": "acls parameter should be present"
        }
    }
    

    This endoint grants access to a user for a specific resource.

    HTTP Request

    PUT /v1/users/1/grant.json

    Request Parameters

    Parameter Type Required Description
    user_id integer true the user id to grant access

    Revoke user access

    Request:

    {
        "acls": {
            "market": [1]
        }
    }
    
    curl -X PUT -d '{"acls": {"market": [1]}' "https://https://users.zuppler.com/v1/users/1/revoke.json?access_token=TOKEN"
    

    Response (200)

    {
        "success":true,
        "user":{
            "id":62344,
            "name":"John Smith",
            "email":"jsmith@example.com",
            "phone":"6109095204",
            "created_at":"2009-06-18 13:52:00 UTC",
            "roles":["user"],
            "zuppler_bucks":17.88,
            "zuppler_points":5412.0,
            "gravatar_id":"d91103fc35162730d228767e64126911",
            "acls": {
                "restaurant_ids": [1, 2, 3],
                "market_ids": [1]
            },
            "links":[
                {"name":"self","methods":["get"],"url":"/v1/users/62344.json"},
                {"name":"vaults","method":"get","url":"/v1/users/62344/vaults.json"},
                {"name":"orders","method":"get","url":"/v1/users/62344/orders.json"},
                {"name":"grant","method":"put","url":"/v1/users/62344/grant.json"},
                {"name":"revoke","method":"put","url":"/v1/users/62344/revoke.json"},
                {"name":"providers","method":"get","url":"/v1/users/62344/providers.json"}
            ]
        }
    }
    

    Response (401)

    {
        "success":false,
        "status": {
            "code": 401,
            "message": "Unauthorized to update access"
        }
    }
    

    Response (400)

    {
        "success":false,
        "status": {
            "code": 400,
            "message": "acls parameter should be present"
        }
    }
    

    This endpoint revokes access to different resources for a user.

    Http Request

    PUT /v1/users/1/revoke/markets_ids/1.json

    Request Parameters

    Parameter Type Required Description
    user_id integer true the user id

    Touch user

    Request:

    curl -X PUT "https://https://users.zuppler.com/v1/users/1/touch.json?access_token=TOKEN"
    

    Response (200)

    {
        "success":true,
        "status": {
            "code": 200,
            "message": "User updated"
        }
    }
    

    Response (401)

    {
        "success":false,
        "status": {
            "code": 401,
            "message": "Unauthorized to update access"
        }
    }
    

    This endpoint touches user and updates search index.

    Http Request

    PUT /v1/users/1/touch.json

    Search users

    Request:

    {
        "name": "silviu r",
        "email": "silviu",
        "phone": "345345",
        "role": "admin"
    }
    
    curl -X POST -d '{"name": "siviu r", "email": "silviu", "role": "user"}' "https://users.zuppler.com/v1/users/search.json?access_token=TOKEN"
    

    Response (200)

    {
       "success":true,
       "total":1,
       "count":1,
       "page":1,
       "users":[
          {
             "uuid":"8b9dba77-f3a7-4149-8b2a-34sffwefwfwef",
             "name":"Silviu Rosu",
             "email":"silviu.rosu@gmail.com",
             "phone":"0757220411",
             "channel_id":1,
             "roles":[
                "admin",
                "config"
             ],
             "created_at":"2011-01-18T08:15:22.000Z",
             "gravatar_id":"d38b3ac02140944a5dc29691dad2a8111",
             "acls":{
             },
             "links":[
                {
                   "name":"self",
                   "methods":[
                      "get"
                   ],
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d"
                },
                {
                   "name":"vaults",
                   "method":"get",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/vaults"
                },
                {
                   "name":"orders",
                   "method":"get",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/orders"
                },
                {
                   "name":"grant",
                   "method":"put",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/grant"
                },
                {
                   "name":"revoke",
                   "method":"put",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/revoke"
                },
                {
                   "name":"touch",
                   "method":"put",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/touch"
                },
                {
                   "name":"providers",
                   "method":"get",
                   "url":"/v1/users/8b9dba77-f3a7-4149-8b2a-947e865c787d/providers"
                }
             ]
          }
       ]
    }
    

    Response (401)

    {
        "success":false,
        "status": {
            "code": 401,
            "message": "Unauthorized to update access"
        }
    }
    

    This endoint searches for a user.

    HTTP Request

    POST /v1/users/search.json

    Request Parameters

    Parameter Type Required Description
    name string false the name of the user
    email string false the email of the user
    phone string false the phone of the user
    role string false the role of the user
    roles array false the roles of the user

    Get user providers

    curl "https://users.zuppler.com/v1/users/1/providers.json?access_token=TOKEN"
    
    user = Zuppler::User.find TOKEN
    user.providers
    

    The above command returns the following JSON:

    {
        "success": true,
        "total": 1,
        "count": 1,
        "page": 0,
        "providers": [
            {
                "provider": "zuppler",
                "created_at": "2016-06-22T06:43:48Z",
                "links": [
                    {
                        "name": "self",
                        "method": "get",
                        "url": "/v1/users/0565232d-4a17-4569-8dd6-b0d082991e82/providers/1.json"
                    }
                ]
            }
        ]
    }
    

    This endpoint returns user's providers list.

    Http Request

    GET /v1/users/1/providers.json

    Get user provider details

    curl "https://users.zuppler.com/v1/users/1/providers/1.json?access_token=TOKEN"
    

    The above command returns the following JSON:

    {
        "success": true,
        "provider":
        {
            "id": 1,
            "provider": "zuppler",
            "token": "5a4d2ef3-85a2-4a8e-939e-9b5098650464",
            "created_at": "2016-06-22T06:43:48Z"
        }
    }
    

    This endpoint returns profile info. Also if the token is expired this url should refesh the token before.

    Http Request

    GET /v1/users/1/providers/1.json

    External login with provider

    Request:

    {
        "secret_key": "fqfqwefwefwe-wfwefwefeqwfqef32423-23423423fdsfwefefew",
        "provider": "punchh"
    }
    

    Response (200)

    {
        "success":true,
        "user":{
            "id":62344,
            "name":"John Smith",
            "email":"jsmith@example.com",
            "phone":"6109095204",
            "created_at":"2009-06-18 13:52:00 UTC",
            "roles":["user"],
            "zuppler_bucks":17.88,
            "zuppler_points":5412.0,
            "gravatar_id":"d91103fc35162730d228767e64126911",
            "acls": {
                "restaurant_ids": [1, 2, 3],
                "market_ids": [1]
            },
            "links":[
                {"name":"self","methods":["get"],"url":"/v1/users/62344.json"},
                {"name":"vaults","method":"get","url":"/v1/users/62344/vaults.json"},
                {"name":"orders","method":"get","url":"/v1/users/62344/orders.json"},
                {"name":"grant","method":"put","url":"/v1/users/62344/grant.json"},
                {"name":"revoke","method":"put","url":"/v1/users/62344/revoke.json"},
                {"name":"providers","method":"get","url":"/v1/users/62344/providers.json"}
            ]
        }
    }
    

    Response (401)

    {
        "success":false,
        "status": {
            "code": 401,
            "message": "Secret key is not valid"
        }
    }
    

    Response (400)

    {
        "success":false,
        "status": {
            "code": 400,
            "message": "secret_key and provider parameters are required"
        }
    }
    

    This endpoint tries to login user with a secret key against a provider. If the key is valid user profile is loaded from provider and synced in users.

    HTTP Request

    POST /v1/external_login.json

    Request Parameters

    Parameter Type Required Description
    secret_key string true secret key to use for authentication
    provider string true provider to authenticate with

    Discounts API

    Staging: loyalty.api.biznettechnologies.com

    Production: loyalty.api.zuppler.com

    Get available discounts

    Response (200):

    {
        "discounts": [
            {
              "id": 1,
              "start_date": "03/03/2017",
              "end_date": null,
              "first_time": false,
              "provider": "zuppler",
              "type": "Percent",
              "promo": false,
              "badge": "11.11%",
              "title": " off on orders more than $1.00",
              "applicable_on": "Sun, Wed, Thu, Fri, Sat with pickup only"
            },
            {
              "id": 1,
              "start_date": "03/03/2017",
              "end_date": "03/05/2017",
              "first_time": false,
              "type": "Reward",
              "provider": "punchh",
              "promo": false,
              "badge": "$20.00",
              "title": "This is a special discount for you",
              "applicable_on": "with delivery by zuppler only"
            }
        ]
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Returns all the discounts for a specific restaurant. Multiple providers are included (zuppler, punchh)

    HTTP Request

    GET /v5/restaurants/:restaurant_id/discounts

    Request Parameters

    Parameter Type Required Description
    channel_id integer true the id of the channel
    restaurant_id integer true the id of the restaurant
    shopping_user_uuid String true the uuid of the shopping user

    Apply discount

    Request:

      {
        "channel_id": 11,
        "loyalty_id": 1,
        "cart_id": "11111",
        "user_id": "111111111",
        "provider": "punchh",
        "promocode": "",
        "subtotal": 22.22,
        "total": 11.11,
        "time": "2017-04-24T18:05:01+05:30",
        "items": [
          {
            "category": "Pizza",
            "category_id": 11,
            "id": 1,
            "menu": "Lunch Menu",
            "menu_id": 111,
            "name": "Dublin Style Bangers & Mash",
            "quantity": 1,
            "price": 11.95
          },
          {
            "category": "Pasta",
            "category_id": 12,
            "id": 9925,
            "menu": "Lunch Menu",
            "menu_id": 112,
            "name": "Pasta Carbonara",
            "quantity": 1,
            "price": 11.95
          }
        ]
      }
    

    Response (200):

    {
        "discount": {
          "id": 1,
          "title": "This is a special discount for you",
          "badge": "$20.00",
          "discount_type": "Reward",
          "provider": "punchh",
          "cart_id": 1
        }
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Apply discount on current cart. It supports all the available providers (zuppler, punchh)

    If the discount is promo code the loyalty_id will be null. Also if provider is null we need to try to apply the promo discount in every loyalty service available.

    HTTP Request

    POST /v5/restaurants/:restaurant_id/discounts

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true the id of the restaurant
    channel_id integer true the id of the channel
    loyalty_id integer false the id of discount
    cart_id integer true cart uuid
    user_id String true the uuid of the shopping user
    provider String true the discount provider (zuppler, punchh)
    promocode String false the promocode to apply
    subtotal float true the subtotal of the cart
    total float true
    time String true order date time in iso8601
    items List true the list of menu items inside the cart

    Response Body

    Parameter Type Description
    id integer the id of shopping discount
    title String Title of the shopping discount
    badge String The badge of the shopping discount
    discount_type String Discount type
    provider String Discount provider
    cart_id integer id of the cart

    Validate discount

    Request:

      {
        "channel_id": 11,
        "loyalty_id": 1,
        "shopping_discount_id": 11,
        "cart_id": "11111",
        "user_id": "111111111",
        "provider": "punchh",
        "subtotal": 22.22,
        "total": 11.11,
        "time": "2017-04-24T18:05:01+05:30",
        "items": [
          {
            "category": "Pizza",
            "category_id": 11,
            "id": 1,
            "menu": "Lunch Menu",
            "menu_id": 111,
            "name": "Dublin Style Bangers & Mash",
            "quantity": 1,
            "price": 11.95
          },
          {
            "category": "Pasta",
            "category_id": 12,
            "id": 9925,
            "menu": "Lunch Menu",
            "menu_id": 112,
            "name": "Pasta Carbonara",
            "quantity": 1,
            "price": 11.95
          }
        ]
      }
    

    Response (200):

    {
        "discount": {
          "id": 1,
          "title": "This is a special discount for you",
          "badge": "$20.00",
          "discount_type": "Reward",
          "provider": "punchh",
          "cart_id": 1
        }
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Validate discount agains corresponding provider.

    HTTP Request

    PUT (or PATCH) /v5/restaurants/:restaurant_id/discounts/:id

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true the id of the restaurant
    channel_id integer true the id of the channel
    loyalty_id integer true the id of discount
    shopping_discount_id integer true the id of shopping discount
    cart_id integer true cart uuid
    user_id String true the uuid of the shopping user
    provider String true the discount provider (zuppler, punchh)
    subtotal float true the subtotal of the cart
    total float true
    time String true order date time in iso8601
    items List true the list of menu items inside the cart

    Response Body

    Parameter Type Description
    id integer the id of shopping discount
    title String Title of the shopping discount
    badge String The badge of the shopping discount
    discount_type String Discount type
    provider String Discount provider
    cart_id integer id of the cart

    Commit discount

    Request:

      {
        "channel_id": 11,
        "loyalty_id": 1,
        "shopping_discount_id": 11,
        "cart_id": "11111",
        "user_id": "111111111",
        "provider": "punchh",
        "subtotal": 22.22,
        "total": 11.11,
        "time": "2017-04-24T18:05:01+05:30",
        "items": [
          {
            "category": "Pizza",
            "category_id": 11,
            "id": 1,
            "menu": "Lunch Menu",
            "menu_id": 111,
            "name": "Dublin Style Bangers & Mash",
            "quantity": 1,
            "price": 11.95
          },
          {
            "category": "Pasta",
            "category_id": 12,
            "id": 9925,
            "menu": "Lunch Menu",
            "menu_id": 112,
            "name": "Pasta Carbonara",
            "quantity": 1,
            "price": 11.95
          }
        ]
      }
    

    Response (200):

    {
        "discount": {
          "id": 1,
          "title": "This is a special discount for you",
          "badge": "$20.00",
          "discount_type": "Reward",
          "provider": "punchh",
          "cart_id": 1
        }
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Commit the discount from the corresponding provider. This is called after checkout when the cart is completed. If validation does not pass the provider may return error.

    HTTP Request

    POST /v5/restaurants/:restaurant_id/discounts/:id/commit

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true the id of the restaurant
    channel_id integer true the id of the channel
    loyalty_id integer true the id of discount
    shopping_discount_id integer true the id of shopping discount
    cart_id integer true cart uuid
    user_id String true the uuid of the shopping user
    provider String true the discount provider (zuppler, punchh)
    subtotal float true the subtotal of the cart
    total float true
    time String true order date time in iso8601
    items List true the list of menu items inside the cart

    Response Body

    Parameter Type Description
    id integer the id of shopping discount
    title String Title of the shopping discount
    badge String The badge of the shopping discount
    discount_type String Discount type
    provider String Discount provider
    cart_id integer id of the cart

    Restaurants V5 API

    Staging: restaurants.api.biznettechnologies.com

    Production: restaurants.api.zuppler.com

    To see all GraphQL available roots and fields access: http://restaurants.api.zuppler.com/graphiql.

    Here you cand find all the fields documentation. Also the graphiql interface has autocomplete when typing query.

    Load restaurant

    Request:

      query Restaurant($restaurant_id: ID!) {
      restaurant(id: $restaurant_id) {
          id
          name
          locale
          permalink
          state
          amenities
          cuisines
          services {
            id
            minOrder
            description
            defaultTime
            defaultChargeAmount
          }
          locations {
            id
            address {
              city
              country
              geo {
                lat
                lng
              }
              state
              street
              zip
            }
          }
        }
      }
    
    
      {"restaurant_id": 242}
    

    Response (200):

      {
      "data": {
        "restaurant": {
          "state": "published",
          "services": [
            {
              "minOrder": "0",
              "id": "PICKUP",
              "description": "Come to the express lane to pickup your order. Your order will be ready and waiting for you. :)",
              "defaultTime": 0,
              "defaultChargeAmount": null
            },
            {
              "minOrder": "10.00",
              "id": "DELIVERY",
              "description": "$2.99 Delivery Fee ",
              "defaultTime": 45,
              "defaultChargeAmount": null
            }
          ],
          "permalink": "demorestaurant",
          "name": "Demo Restaurant",
          "locations": [
            {
              "id": "5674",
              "address": {
                "zip": "19428",
                "street": "600 e elm street",
                "state": "pa",
                "geo": {
                  "lng": -75.292653,
                  "lat": 40.073962
                },
                "country": "US",
                "city": "conshohocken"
              }
            }
          ],
          "locale": "en",
          "id": "242",
          "cuisines": "Pizza, Seafood, Continental",
          "amenities": "Online Orders, Delivery, Cocktail, Air Condition (A/C), Late Night, (Mon - Thu) Dinner Delivery Only, Carry Out, Pick Up, Coupons"
        }
      }
    }
    
    

    Loads information about restaurant.

    HTTP Request

    POST /graphql

    Request Parameters

    Parameter Type Required Description
    query string true graphQl query
    variables string false graphql query variables if any
    operationName string false graphql query name if applicable

    Load restaurant menus

    Request:

      query RestaurantMenu($restaurant_id: ID!) {
      menus(restaurantId: $restaurant_id) {
            id
          name
          description
          default
          availability {
            custom
            days
            services
            time {
              close
              open
            }
          }
          categories {
            id
            name
            description
            priority
            items {
              id
              name
              description
              price
              minQty
              multipleSizes
              modifiersCount
              featured
              coupon
              couponCode
              priority
              active
              image {
                active
                id
                xlarge
                medium
                thumb
                tiny
                original
              }
            }
          }
        }
       }
    
      {"restaurant_id": 242}
    

    Response (200):

    {
      "data": {
        "menus": [
          {
            "name": "Menu",
            "id": "235",
            "description": null,
            "default": true,
            "categories": [
              {
                "priority": 1,
                "name": "Specialty Pizzas",
                "items": [
                  {
                    "priority": 6,
                    "price": 10.09,
                    "name": "Deluxe Pizza",
                    "multipleSizes": true,
                    "modifiersCount": 2,
                    "minQty": 0,
                    "image": {
                      "xlarge": null,
                      "tiny": null,
                      "thumb": null,
                      "original": null,
                      "medium": null,
                      "id": null,
                      "active": false
                    },
                    "id": "97196",
                    "featured": false,
                    "description": "sausage, pepperoni, mushrooms, onions and green peppers",
                    "couponCode": null,
                    "coupon": false,
                    "active": true
                  },
                  {
                    "priority": 3,
                    "price": 9.19,
                    "name": "Vegetarian Pizza",
                    "multipleSizes": true,
                    "modifiersCount": 2,
                    "minQty": 0,
                    "image": {
                      "xlarge": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/052/227/xlarge/Veggie_Pizza.jpg",
                      "tiny": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/052/227/tiny/Veggie_Pizza.jpg",
                      "thumb": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/052/227/thumb/Veggie_Pizza.jpg",
                      "original": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/052/227/original/Veggie_Pizza.jpg",
                      "medium": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/052/227/medium/Veggie_Pizza.jpg",
                      "id": "52227",
                      "active": true
                    },
                    "id": "97204",
                    "featured": false,
                    "description": "onions, green peppers and black olives",
                    "couponCode": null,
                    "coupon": false,
                    "active": true
                  }
                ],
                "id": "10318",
                "description": "All our pizzas are topped with Flor di Latte mozzarella and tomato"
              }
            ],
            "availability": {
              "time": [],
              "services": 15,
              "days": 255,
              "custom": false
            }
          },
          {
            "name": "Coupons",
            "id": "28693",
            "description": null,
            "default": false,
            "categories": [
              {
                "priority": 0,
                "name": "Online Coupons",
                "items": [
                  {
                    "priority": 2,
                    "price": 0,
                    "name": "Free Appetizer for orders more than $15",
                    "multipleSizes": false,
                    "modifiersCount": 1,
                    "minQty": 0,
                    "image": {
                      "xlarge": null,
                      "tiny": null,
                      "thumb": null,
                      "original": null,
                      "medium": null,
                      "id": null,
                      "active": false
                    },
                    "id": "843242",
                    "featured": false,
                    "description": " * 0 minimum.",
                    "couponCode": null,
                    "coupon": false,
                    "active": true
                  }
                ],
                "id": "92037",
                "description": ""
              }
            ],
            "availability": {
              "time": [
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                },
                {
                  "open": 900,
                  "close": 900
                }
              ],
              "services": 15,
              "days": 0,
              "custom": true
            }
          }
        ]
      }
    }
    

    Loads information about zuppler menu.

    HTTP Request

    POST /graphql

    Request Parameters

    Parameter Type Required Description
    query string true graphQl query
    variables string false graphql query variables if any
    operationName string false graphql query name if applicable

    Load menu item

    Request:

      {
        item(itemId: 902622) {
          id
          description
          name
          veg
          spicy
          sizes {
            id
            sizeId
            sizeName
            coupon
            priority
            active
            minQty
            price
            modifiers {
              id
              name
             description
                active
                priority
                multipleSelections
                multipleModifiers
                minSelections
                maxSelections
                allowGrouping
              options {
                id
                name
                description
                active
                priority
                weight
                group
                groupLabel
                image {
                  active
                  original
                }
              }
            }
          }
        }
      }
    

    Response (200):

    {
      "data": {
        "item": {
          "veg": null,
          "spicy": null,
          "sizes": [
            {
              "sizeName": "",
              "sizeId": null,
              "priority": 0,
              "price": 0.75,
              "modifiers": [
                {
                  "priority": 1,
                  "options": [
                    {
                      "weight": 1,
                      "priority": 0,
                      "name": "Original",
                      "image": {
                        "original": null,
                        "active": false
                      },
                      "id": "870321",
                      "groupLabel": null,
                      "group": null,
                      "description": null,
                      "active": true
                    },
                    {
                      "weight": 1,
                      "priority": 0,
                      "name": "Ultimate Fresh Mango",
                      "image": {
                        "original": null,
                        "active": false
                      },
                      "id": "870322",
                      "groupLabel": null,
                      "group": null,
                      "description": null,
                      "active": true
                    }
                  ],
                  "name": "Choose Flavors",
                  "multipleSelections": false,
                  "multipleModifiers": null,
                  "minSelections": 1,
                  "maxSelections": null,
                  "id": "360201",
                  "description": null,
                  "allowGrouping": null,
                  "active": true
                },
                {
                  "priority": 3,
                  "options": [
                    {
                      "weight": 1,
                      "priority": 0,
                      "name": "Banana",
                      "image": {
                        "original": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/058/083/original/Banana.png",
                        "active": true
                      },
                      "id": "870284",
                      "groupLabel": "Fruits",
                      "group": "Fruits",
                      "description": null,
                      "active": true
                    },
                    {
                      "weight": 1,
                      "priority": 34,
                      "name": "Strawberry",
                      "image": {
                        "original": "https://dbgcbnch6yz43.cloudfront.net/images/pictures/files/000/057/066/original/strawberry_frappe.jpg",
                        "active": true
                      },
                      "id": "870191",
                      "groupLabel": "Fruits",
                      "group": "Fruits",
                      "description": "Small – Kcal: 203, Carbs: 38G, Protein: 7G, Fat: 3G – Regular – Kcal: 269, Carbs: 51G, Protein: 10G, Fat: 3G\n",
                      "active": true
                    }
                  ],
                  "name": "Pick Toppings up to 3",
                  "multipleSelections": true,
                  "multipleModifiers": true,
                  "minSelections": 0,
                  "maxSelections": 3,
                  "id": "360203",
                  "description": null,
                  "allowGrouping": true,
                  "active": true
                }
              ],
              "minQty": 0,
              "id": "902622",
              "coupon": null,
              "active": true
            }
          ],
          "name": "Small Frozen Yogurt",
          "id": "870258",
          "description": " "
        }
      }
    }
    

    Loads information about menu item.

    HTTP Request

    POST /graphql

    Request Parameters

    Parameter Type Required Description
    query string true graphQl query
    variables string false graphql query variables if any
    operationName string false graphql query name if applicable

    Load all translations

    Request:

    {
        "restaurant_id": 242
    }
    

    Response (200):

    [
      {
        "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/1",
        "locale": "fr",
        "id": 1
      },
      {
        "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/4",
        "locale": "ar",
        "id": 4
      },
      {
        "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/6",
        "locale": "ja",
        "id": 6
      },
      {
        "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
        "locale": "en",
        "id": 7
      }
    ]
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Load all restaurant available translations. Only the locales availables are returned and show url for each.

    HTTP Request

    GET /v5/restaurants/:restaurant_id/translations

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale

    Load translations for locale

    Request:

    {
        "restaurant_id": 242,
        "locale": "en"
    }
    

    Response (200):

    [
      {
        "translations": {"Beverage": "Bauturi"},
        "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
        "locale": "en",
        "id": 7
      }
    ]
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Load restaurant translations for specified locale

    HTTP Request

    GET /v5/restaurants/:restaurant_id/translations?locale=:locale

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant
    locale String true required locale

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale
    translations map map of translations. Key is the english text and value is the translation in specified locale

    Load translation by id

    Request:

    {
        "restaurant_id": 242,
        "id": 7
    }
    

    Response (200):

    {
      "translations": {
        "Beverage": "Bauturi"
      },
      "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
      "locale": "en",
      "id": 7
    }
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Load restaurant translation by id.

    HTTP Request

    GET /v5/restaurants/:restaurant_id/translations/:id

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant
    id integer true id of the translation

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale
    translations map map of translations. Key is the english text and value is the translation in specified locale

    Create translation

    Request:

    {
      "restaurant_id": 242,
      "translation": {
        "locale": "en",
        "translations": {
          "Beverage": "Bauturi", "served with French fries": "servit cu cartofi"
        }
      }
    }
    

    Response (200):

    {
      "translations": {
        "served with French fries": "servit cu cartofi", "Beverage": "Bauturi"
      },
      "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
      "locale": "en",
      "id": 7
    }
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Create new translation

    HTTP Request

    POST /v5/restaurants/:restaurant_id/translations

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant
    translation map true translations to be created

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale
    translations map map of translations. Key is the english text and value is the translation in specified locale

    Update translation

    Request:

    {
      "translation": {
        "locale": "en",
        "translations": {
          "Beverage": "Bauturi", "served with French fries": "servit cu cartofi"
        }
      }
    }
    

    Response (200):

    {
      "translations": {
        "served with French fries": "servit cu cartofi", "Beverage": "Bauturi"
      },
      "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
      "locale": "en",
      "id": 7
    }
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Update translation content

    HTTP Request

    PUT /v5/restaurants/:restaurant_id/translations/:id

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant
    id integer true id of the translation
    translation map true translations to be changed

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale
    translations map map of translations. Key is the english text and value is the translation in specified locale

    Sync translations between restaurants

    Request:

    {
      "locale": "en",
      "destination_restaurant_id": 243
    }
    

    Response (200):

    {
      "translations": {
        "served with French fries": "servit cu cartofi", "Beverage": "Bauturi"
      },
      "resource_url": "http://restaurants.api.zuppler.com/v5/restaurants/242/translations/7",
      "locale": "en",
      "id": 7
    }
    

    Response (400 Bad Request):

    {
        "error": "Required parameters are missing"
    }
    

    Sync translations between restaurant. All the translations are copied from one restaurant to other. It overrides all the existing translations on destination restaurant.

    HTTP Request

    PUT /v5/restaurants/:restaurant_id/sync_translations

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of the restaurant
    locale String true locale to be synced
    destination_restaurant_id integer true id of the destination restaurant

    Response Body

    Field Type Description
    id integer the id of the translation
    locale String the locale of the translation
    resource_url String url of the show locale
    translations map map of translations. Key is the english text and value is the translation in specified locale

    Carts V5 API

    Staging: carts-api.biznettechnologies.com

    Production: carts-api.zuppler.com

    ✅ Create customer

    Request:

    {
        "channel_id": 11,
        "integration_url": "http://www.zuppler.com"
    }
    

    Response (200):

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
      "name": nil,
      "email": nil,
      "phone": nil,
      "logged_in": false,
      "url": "http://carts-api.biznettechnologies.com/v5/customer/a2193718-1211-4f80-a83e-2aa17fb7df11.json"
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing"
    }
    

    Create Customer

    HTTP Request

    POST /v5/customers

    Request Parameters

    Parameter Type Required Description
    channel_id integer or string true id or permalink of the channel
    integration_url string true integration url

    Response Body

    Field Type Description
    id String the uuid of the shopping user
    name String name of the shopping user
    email String email of the shopping user
    phone String phone of the shopping user
    logged_in boolean if the user is logged in
    url string url to load customer

    ✅ Load customer info

    Response (200):

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
      "name": "Silviu Rosu",
      "email": "silviu.rosu@zuppler.com",
      "phone": "1234567890",
      "logged_in": false,
      "url": "http://carts-api.biznettechnologies.com/v5/customer/a2193718-1211-4f80-a83e-2aa17fb7df11.json"
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing"
    }
    

    Response (404 Bad Request):

    {
        "message": "Customer not found"
    }
    

    Load Customer Info

    If the customer is available create a process for it.

    HTTP Request

    GET /v5/customers/:id

    Request Parameters

    Parameter Type Required Description
    id string true uuid of shopping user

    Response Body

    Field Type Description
    id String the uuid of the shopping user
    name String name of the shopping user
    email String email of the shopping user
    phone String phone of the shopping user
    logged_in boolean if the user is logged in
    url string url to load customer

    ✅ Update customer

    Request:

    {
      "action": "update",
      "payload": {
        "name": "Silviu Rosu",
        "email": "silviu@zuppler.com",
        "phone": "1234567890"
      }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing"
    }
    

    Response (400 Bad Request):

    {
        "errors": {
          "name": "can't be blank",
          "email": "is invalid format",
          "phone": "should have at least 8 character(s)"
        }
    }
    

    Update Customer info. Validation is not done at this step. We only update received fields.

    HTTP Request

    POST /v5/customers/:id

    (url will be provided on create customer)

    Request Parameters

    Parameter Type Required Description
    action String true "update" action will be provided here
    payload: {
        name string false customer full name
        email string false customer email
        phone string false customer phone number

    }

    Response Body

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
      "name": "Silviu Rosu",
      "email": "silviu.rosu@zuppler.com",
      "phone": "1234567890",
      "logged_in": true
    }
    

    ✅ Login with token

    Request:

    {
      "action": "login",
      "payload": {
        "access_token": "e095737b4fb1a916b0d7uybkc41e77124e4beb6f4c51c3e7ddbac5a34f4dc09"
      }
    }
    

    Response (200):

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
      "name": "Silviu Rosu",
      "email": "silviu.rosu@zuppler.com",
      "phone": "1234567890",
      "logged_in": true,
      "url": "http://carts-api.biznettechnologies.com/v5/customer/a2193718-1211-4f80-a83e-2aa17fb7df11.json"
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Login shopping user with token

    HTTP Request

    POST /v5/customers/:id

    (url will be provided on create customer)

    Request Parameters

    Parameter Type Required Description
    action String true "login" action will be provided here
    payload: {
        access_token string true access token to authenticate with
    }

    Response Body

    Field Type Description
    id integer shopping user id
    name string name
    email string email
    phone string
    logged_in boolean if user is successfully logged in

    ✅ Load user addresses

    Request:

    {
      "action": "load_addresses",
      "payload": {
      }
    }
    

    Response (200):

    [
      {
        "id": 1,
        "nickname": "201 S Jefferson St",
        "mini": "201 South Jefferson Street, Pensacola",
        "full": "201 S Jefferson St, Pensacola, FL 32502, USA 32502",
        "block": "",
        "city": "Pensacola",
        "country": "US",
        "state": "FL",
        "zip": "32502",
        "lat": 30.410329,
        "lng": 87.2139,
        "delivery_instructions": ""
      }
    ]
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Load user addresses from past orders. If the user is not logged in or has no past orders the list will be empty.

    HTTP Request

    POST /v5/customers/:id

    (url will be provided on create customer)

    Request Parameters

    Parameter Type Required Description
    action String true "load_addresses" action will be provided here
    payload: {

    }

    Response Body

    Field Type Description
    [
       {
         id integer address id
         block string block
         city string address city
         full string full address
         mini string mini address
         nickname string address nickname
         state string address state
         zip string address zip
         country string address country
         position {
           latitude float address latitude
           longitude float address longitude
         }
         delivery_instructions string delivery instructions
       }
    ]

    ✅ Create user address

    Request:

    {
      "action": "create_address",
      "payload": {
        "block": "Ap 12",
        "city": "Conshohocken",
        "complete_address": "738 E Elm St, Conshohocken, PA 19428, USA",
        "country": "United States",
        "cross_street": "232",
        "delivery_instructions": "Call the phone",
        "lat": 30.410329,
        "lng": 87.2139,
        "nickname": "Zuppler Office",
        "precision": 5,
        "state": "PA",
        "street": "730 East Elm Street",
        "zip": "32502"
      }
    }
    

    Response (200):

    {
      "id": 111,
      "block": "Ap 12",
      "city": "Conshohocken",
      "full": "738 E Elm St, Conshohocken, PA 19428, USA",
      "mini": "730 East Elm Street, Conshohocken",
      "nickname": "Zuppler Test",
      "state": "FL",
      "zip": "32502",
      "country": "USA",
      "lat": 30.410329,
      "lng": 87.2139,
      "delivery_instructions": ""
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Create user address.

    HTTP Request

    POST /v5/customers/:id

    (url will be provided on create customer)

    Request Parameters

    Parameter Type Required Description
    action String true "create_address" action will be provided here
    payload: {
         block string false block
         city string false address city
         complete_address string false full address
         country string false address country
         cross_street string false cross street instructions
         delivery_instructions string false delivery instructions
         lat string true latitude
         lng string true longitude
         nickname string false address nickname
         precision string true address precision
         state string false address state
         street string false street
         zip string false address zip
    }

    Response Body

    Field Type Description
    id integer address id
    block string block
    city string address city
    full string full address
    mini string mini address
    nickname string address nickname
    state string address state
    zip string address zip
    country string address country
    lat float address latitude
    lng float address longitude
    delivery_instructions string delivery instructions

    ✅ Create cart

    Request:

    {
        "customer_id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
        "integration_url": "http://carts-api.biznettechnologies.com/",
        "channel_id": "zuppler",
        "restaurant_id": 11,
        "integration_remote_id": "demo_restaurant",
    }
    

    Response (200):

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11.json",
      "totals": {
        "subtotal": 0,
        "savings": 0,
        "tax": 0,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 0
      },
      "order": nil,
      "time": nil,
      "tender": nil,
      "tip": nil,
      "delivery_address": nil,
      "extra_items": {},
      "items": [],
      "url": "http://carts-api.biznettechnologies.com/v5/carts/a2193718-1211-4f80-a83e-2aa17fb7df11.json"
    }
    

    Response (400 Bad Request):

    {
      "message": "Required parameters are missing"
    }
    

    Create Shopping Cart.

    Validate if the restaurant is not paused.

    HTTP Request

    POST /v5/carts

    Request Parameters

    Parameter Type Required Description
    customer_id string true uuid of customer
    integration_url string true url of the integration
    channel_id integer or string true id or permalink of the channel
    restaurant_id integer true id of the restaurant
    integration_remote_id string true remote id of the integration

    Response Body

    Field Type Description
    id String the uuid of the shopping cart
    url String the show url for shopping cart
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    order
    time
    tender
    tip
    items []
    extra_fields map extra fields for the cart

    ✅ Load cart

    Response (200):

    {
      "id": "a2193718-1211-4f80-a83e-2aa17fb7df11",
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      },
      "order": {
        "selected": "DELIVERY",
        "value": 20
      },
      "time": {
        "selected": "SCHEDULE",
        "value": "2017-09-12 01:00"
      },
      "tender": {
        "selected": "CASH",
        "value": null
      },
      "tip": {
        "selected": "PERCENT",
        "value": 500
      },
      "delivery_address": {
        "id": 1,
        "street": "730 E Elm street",
        "city": "Conshohoken",
        "state": "PA",
        "zip": "19428"
        "country": "US",
        "block": nil,
        "lat": 40.077356,
        "lng": -75.303191
      },
      "extra_fields": {"gigi": "becali", "napkins": yes},
      "items": [],
      "url": "http://carts-api.biznettechnologies.com/v5/carts/a2193718-1211-4f80-a83e-2aa17fb7df11.json"
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Load shopping cart.

    Validate that the cart is not closed.

    HTTP Request

    GET /v5/carts/:id

    (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    id String true the uuid of the cart

    Response Body

    Field Type Description
    id String the uuid of the shopping cart
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    order {
         type string selected order type (DELIVERY, PICKUP)
         address_id/location_id/vehicle Depends of selected order (Delivery - address_id, PICKUP - location_id, CURBSIDE - vehicle)
    }
    time {
         type string selected order time (SCHEDULE, ASAP)
         value string time for delivery
    }
    tender {
         type string selected tender type (CASH, CARD)
         value string only for buck id
    tip {
         type string selected tip type (PERCENT, FIXED)
         value integer tip value
    }
    delivery_address {
         id integer address id
         street string address streeet
         city string address city
         state string address state
         zip string address zip
         country string address country
         lat float address lat
         lng float address lng
    }
    items [
       {
         id integer shopping item id
         quantity integer item quantity
         comments string item comments
         name string item name
         price integer item price (cents)
         total_price integer (item price + sum modifiers) * item quantity
         coupon boolean item has coupon
         image_url string item image url (thumb)
         menu_item_id integer menu item id
         menu_size_id integer menu size item id
         menu_category_id integer item menu category id
         discountable boolean if discounts can be applied on this item
         size string name of the size
         modifiers [
           {
               id integer modifier id
               quantity integer modifier quantity
               name string modifier name
               price integer modifier price (cents)
               choice_id integer modifier choice id
               choice_name string modifier choice name
           }
         ]
       }
    ]
    extra_fields map extra fields for the cart
    url String the show url for shopping cart

    ✅ Add item to cart

    Request:

    {
        "action": "add_item",
        "payload": {
          "id": 2121,
          "comments": "special instructions",
          "quantity": 2,
          "modifiers": [{
            "id": 23235,
            "quantity": 1
          }]
        }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11.98,
        "savings": 0.0,
        "tax": 7.87,
        "taxable_service": 0.0,
        "tip": 0.0,
        "service": 0.0,
        "delivery": 0.0,
        "total": 12.98
      },
      "item": {
        "shopping_id": 1,
        "quantity": 3,
        "comments": "No spicy",
        "name": "Tika masalla",
        "price": 121,
        "total_price": 130,
        "coupon": false,
        "image_url": "",
        "menu_item_id": 11,
        "menu_size_id": 12,
        "menu_category_id": 13,
        "size": "large",
        "discountable": true,
        "modifiers": [
          {
            "id": 12121,
            "quantity": 2,
            "name": "Garlic naan",
            "price": 12,
            "choice_id": 1,
            "choice_name": "Sides"
           }
         ]
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Item does not belong to restaurant menu"
    }
    

    Validations performed:

    If they are not valid 400 response is returned with the error message.

    If validation passes the totals are recalculated and returned back.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "add_item" action will be provided here
    payload: {
        id integer true item id from restaurant menu (Ordering::Item id)
        coments String false item instructions
        quantity integer true item quantity
        options [{
          id integer true options id from restaurant menu
          quantity integer true options quantity
        }]
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         discountable_subtotal integer discountable subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    item {
       shopping_id integer shopping item id
       quantity integer shopping item quantity
       comments string shopping item comments
       name string shopping item name
       price integer shopping item price (cents)
       total_price integer (shopping item price + sum modifiers) * shopping item quantity
       coupon boolean shopping item has coupon
       image_url string shopping item image url (thumb)
       menu_item_id integer menu item id
       menu_size_id integer menu size item id
       menu_category_id integer item menu category id
       size string name of the size
       discountable boolean if discounts can be applied on this item
       modifiers [
         {
             id integer shopping customization id
             quantity integer shopping customization quantity
             name string shopping customization name
             price integer shopping customization price (cents)
             choice_id integer menu choice id
             choice_name string menu choice name
         }
       ]
    }

    ✅ Update item in cart

    Request:

    {
        "action": "update_item",
        "payload": {
          "id": 2121,
          "shopping_id": 111111,
          "comments": "special instructions",
          "quantity": 2,
          "options": [
            "id": 23235,
            "quantity": 1
          ]
      }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      },
      "item": {
        "shopping_id": 1,
        "quantity": 3,
        "comments": "No spicy",
        "name": "Tika masalla",
        "price": 121,
        "total_price": 130,
        "coupon": false,
        "image_url": "",
        "menu_item_id": 11,
        "menu_size_id": 12,
        "menu_category_id": 13,
        "size": "large",
        "discountable": true,
        "modifiers": [
          {
            "id": 12121,
            "quantity": 2,
            "name": "Garlic naan",
            "price": 12,
            "choice_id": 1,
            "choice_name": "Sides"
           }
         ]
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Item does not belong to any menu for current restaurant"
    }
    

    Validations performed:

    If validation fails 400 response is returned with the error message.

    If validation passes the totals are recalculated and returned back.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "update_item"
    payload: {
         id integer true menu item id
         shopping_id integer true shopping item id
         coments String false menu item instructions
         quantity integer true menu item quantity
        options [{
           id integer true menu modifier id
           quantity integer true menu modifier quantity
         }]
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         discountable_subtotal integer discountable subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    item {
       shopping_id integer item id
       quantity integer item quantity
       comments string item comments
       name string item name
       price integer item price (cents)
       total_price integer (item price + sum modifiers) * item quantity
       coupon boolean item has coupon
       image_url string item image url (thumb)
       menu_item_id integer menu item id
       menu_size_id integer menu size item id
       menu_category_id integer item menu category id
       size string name of the size
       discountable boolean if discounts can be applied on this item
       modifiers [
         {
             id integer modifier id
             quantity integer modifier quantity
             name string modifier name
             price integer modifier price (cents)
             choice_id integer modifier choice id
             choice_name string modifier choice name
         }
       ]
    }

    ✅ Update item quantity

    Request:

    {
        "action": "update_item_quantity",
        "payload": {
          "shopping_id": 21211,
          "quantity": 2
      }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      },
      "item": {
        "shopping_id": 1,
        "quantity": 3,
        "comments": "No spicy",
        "name": "Tika masalla",
        "price": 121,
        "total_price": 130,
        "coupon": false,
        "image_url": "",
        "menu_item_id": 11,
        "menu_size_id": 12,
        "menu_category_id": 13,
        "size": "large",
        "discountable": true,
        "modifiers": [
          {
            "id": 12121,
            "quantity": 2,
            "name": "Garlic naan",
            "price": 12,
            "choice_id": 1,
            "choice_name": "Sides"
           }
         ]
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Item was not found in the cart"
    }
    

    Validations performed:

    If validation fails 400 is returned with the error message. Otherwise the quantity is updated and new totals are recalculated.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "update_item_quantity"
    payload: {
         shopping_id integer true shopping item id
         quantity integer true new item quantity
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         discountable_subtotal integer discountable subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    item {
       shopping_id integer shopping item id
       quantity integer shopping item quantity
       comments string shopping item comments
       name string shopping item name
       price integer shopping item price (cents)
       total_price integer (shopping item price + sum modifiers) * shopping item quantity
       coupon boolean shopping item has coupon
       image_url string shopping item image url (thumb)
       menu_item_id integer menu item id
       menu_size_id integer menu size item id
       menu_category_id integer item menu category id
       size string name of the size
       discountable boolean if discounts can be applied on this item
       modifiers [
         {
             id integer modifier id
             quantity integer modifier quantity
             name string modifier name
             price integer modifier price (cents)
             choice_id integer modifier choice id
             choice_name string modifier choice name
         }
       ]

    }

    ✅ Delete item from cart

    Request:

    {
        "action": "delete_item",
        "payload": {
          "shopping_id": 2121
      }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Item was not found in the cart"
    }
    

    Validations performed:

    If validation fails 400 is returned with the error message. Otherwise the item size is removed and new totals are recalculated.

    HTTP Request

    POST cart_url url wil be provided on create cart

    Request Parameters

    Parameter Type Required Description
    action String true "delete_item"
    payload: {
         shopping_id integer true shopping item id
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)

    }

    ✅ Set order type

    Request:

    {
        "action": "set_order_type",
        "payload": {
          "order_type": "DELIVERY"
        }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      },
      "order": {
        "selected": "DELIVERY",
        "value": 20
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set order type for cart

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_order_type"
    payload: {
         order_type String true order type to set for cart
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }
    order {
         type string selected order type (DELIVERY, PICKUP)
         address_id/location_id/vehicle Depends of selected order (Delivery - address_id, PICKUP - location_id, CURBSIDE - vehicle)
    }

    ✅ Set restaurant location

    Response (200):

    {
      "action": "set_location",
      "payload": {
        "location_id": 11
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set restaurant location for cart

    HTTP Request

    POST cart_url url will be provided on create cart

    Request Parameters

    Parameter Type Required Description
    action String true "set_location"
    payload: {
         location_id integer true restaurant location id
    }

    Response Body

    empty body

    ⛔ Set curbside info

    Request:

    {
        "action": "set_curbside_info",
        "payload": {
          "curbside_info": "fsfwfwefwefwefwef wefwefwefe"
        }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    If order type is CURBSIDE we can send additional curbside info

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_curbside_info"
    payload: {
         curbside_info String true additional info for curbside
    }

    Response Body

    empty body

    ✅ Set time type

    Request:

    {
        "action": "set_time",
        "payload": {
          "type":    "SCHEDULED",
          "value":   "2018-04-16T13:08:50"
        }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set time type for cart. We need to validate peak hours conditions and cut_offs at this point.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_time" action will be provided here
    payload: {
         time_type String true time type for cart (ASAP, SCHEDULED, EVENT)
         value String true this is required for scheduled or event types
    }

    Response Body

    empty body

    ✅ Set tip

    Request:

    {
        "action": "set_tip",
        "payload": {
          "type":    "AMOUNT",
          "value":   12
        }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 11198,
        "discountable_subtotal": 11101.11,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set tip for cart

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_tip" action will be provided here
    payload: {
         type String true tip type (PERCENT, AMOUNT)
         value integer true tip amount or percent (cents or full procent - no float number)
    }

    Response Body

    Field Type Description
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         discountable_subtotal integer discountable subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }

    ✅ Set delivery address

    Request:

    {
      "action": "set_delivery_address",
      "payload": {
        "address_id": 112121
      }
    }
    

    Response (200):

    {
      "delivery_info": {
        "min_order_amount": 10.0,
        "limit_order_amount": 200,
        "charge_amount": 2.3,
        "charge_percent": 3.5,
        "time": 30
      },
      "totals": {
        "subtotal": 11198,
        "savings": 0,
        "tax": 784,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 11982
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Does not deliver to this address"
    }
    

    Set delivery address. Returns error if does not deliver to this address

    HTTP Request

    POST cart_url url will be provided on create cart

    Request Parameters

    Parameter Type Required Description
    action String true "set_delivery_address"
    payload: {
         address_id integer true address id
    }

    Response Body

    Field Type Description
    delivery_info {
         min_order_amount float min order amount
         limit_order_amount integer max order amount
         charge_amount float delivery charge amount
         charge_percent float delivery charge percent
         time integer delivery time
    }
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }

    ✅ Set order comments

    Request:

    {
        "action": "set_order_comments",
        "payload": {
          "value":   "Lorem ipsum"
        }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set order comments for cart

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_order_comments"
    payload: {
         value String true comments
    }

    Response Body

    empty body

    ✅ Set extra fields

    Request:

    {
        "action": "set_extra_fields",
        "payload": {
          "field1": 1,
          "field2": "sfsdfsdf"
        }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set extra fields for cart

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_extra_fields"
    payload: {
         field_name any false list of extra fields
    }

    Response Body

    empty body

    ⛔ Set tender

    Request:

    {
        "action": "set_tender",
        "payload": {
          "type": "CARD",
          "value": "",
          }
        }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "message"
    }
    

    Set tender for cart

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "set_tender"
    payload: {
         type String true tender for cart (CARD, BUCKID)
         value String false tender value required only if it's BICKID
    }

    Response Body

    empty body

    ⛔ Load available discounts

    Request:

    {
      "action": "load_discounts",
      "payload": {
      }
    }
    

    Response (200):

    {
        "has_promo": true,
        "discounts": [
            {
              "id": 1,
              "start_date": "03/03/2017",
              "end_date": null,
              "provider": "zuppler",
              "type": "Percent",
              "badge": "11.11%",
              "title": " off on orders more than $1.00",
              "applicable_on": "Sun, Wed, Thu, Fri, Sat with pickup only"
            },
            {
              "id": 1,
              "start_date": "03/03/2017",
              "end_date": "03/05/2017",
              "type": "Reward",
              "provider": "punchh",
              "badge": "$20.00",
              "title": "This is a special discount for you",
              "applicable_on": "with delivery by zuppler only"
            }
        ]
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Returns all the discounts applicable for current cart. Multiple providers are included (zuppler, punchh, repeat rewards)

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "load_discounts" action will be provided here
    payload: { empty payload
    }

    Response Body

    Field Type Description
    has_promo boolean if restaurant has promo discounts enabled
    discounts[
       {
         id string discount id
         start_date string start date of the discount
         end_date string end date of the discount
         type string type of the discount
         provider string discount provider
         badge string readable value of the discount
         title string title of the discount
         applicable_on string readable description for discount availability
       }
    ]

    ⛔ Apply discount

    Request:

    {
      "action": "apply_discount",
      "payload": {
        "loyalty_id": 1,
        "provider": "punchh"
      }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 0,
        "savings": 0,
        "tax": 0,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 0
      },
      "discount": {
        "id": 1,
        "title": "This is a special discount for you",
        "badge": "$20.00",
        "discount_type": "Reward",
        "provider": "punchh"
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Apply discount to current card.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "apply_discount" action will be provided here
    payload: {
       loyalty_id integer true discount id
       provider string true discount provider
    }

    Response Body

    Field Type Description
    discount {
       id integer shopping discount id
       title string discount title
       badge string discount badge
       discount_type string discount type
       provider string discount provider
    }
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }

    ⛔ Apply promo code

    Request:

    {
      "action": "apply_promocode",
      "payload": {
        "promocode": "sfsdfsfse"
      }
    }
    

    Response (200):

    {
      "totals": {
        "subtotal": 0,
        "savings": 0,
        "tax": 0,
        "tip": 0,
        "service": 0,
        "delivery": 0,
        "total": 0
      },
      "discount": {
        "id": 1,
        "title": "This is a special discount for you",
        "badge": "$20.00",
        "discount_type": "Reward",
        "provider": "punchh"
      }
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Apply promocode discount to current card.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "apply_discount" action will be provided here
    payload: {
       promocode string true discount promo code
    }

    Response Body

    Field Type Description
    discount {
       id integer shopping discount id
       title string discount title
       badge string discount badge
       discount_type string discount type
       provider string discount provider
    }
    totals {
         subtotal integer subtotal amount of items (cents) in the cart
         savings integer savings (cents)
         tax integer tax (cents)
         tip integer tip (cents)
         service integer service (cents)
         delivery integer delivery (cents)
         total integer total cart (cents)
    }

    ⛔ Commit discount

    Request:

    {
      "action": "commit_discount",
      "payload": {
        "loyalty_id": 1,
        "provider": "punchh"
      }
    }
    

    Response (200):

    {
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Commit discount for provider. This endpoint will consume the discount in provider and also redeem points for the order.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "commit_discount" action will be provided here
    payload: {
       loyalty_id integer true loyalty id
       provider string true discount provider
    }

    ⛔ Load restaurant order time types

    Request:

    {
      "action": "load_order_time_types",
      "payload": {
      }
    }
    

    Response (200):

    {
      "order_time_types": ["ASAP", "SCHEDULED"],
      "day_offs": [69, 70, 71, 185,247],
      "service_hours": [
        [[480,600],[750,1260],[1260,1380]],
        [[480,600],[1260,1380]],
        [[480,600],[750,1260],[1260,1380]],
        [[480,600],[750,1260],[1260,1380]],
        [[480,600],[600,1260],[1260,1380]],
        [[480,600],[750,1260],[1260,1380]],
        [[480,600],[750,1260],[1260,1380]]
      ],
      "hints":[
        "Delivery available between 10:00AM and 15:00PM"],
        "Delivery time is 30 minutes and kitchen closes 30 minutes before",
        "Delivery is not available",
        "",
        "",
        "",
        ""
      ]
      "erliest_date_time": "2018-04-16T13:08:50",
      "asap_duration": 50
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing"
    }
    

    Load restaurant order time types and service hours based on the current status of the cart.

    Service hours will be calculated only if the order type is SCHEDULED (for ASAP it does not apply)

    Since we are doing all this filtering upfront the user needs to know why the time is not available for certain intervals. That's why we have a list of hints that needs to be displayed for each day.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    id integer true restaurant id

    Response Body

    Field Type Description
    order_time_types array the list of order time types for this restaurant
    day_offs list list of all days offs. cut_offs are calculated and included here also as a day off
    service_hours list list of available service hours
    hints list list of hints to be displayed for each day of week. It explains how the service hours have been calculated
    erliest_date_time string Earliest date time available to order
    asap_duration integer Duration required for ASAP starting from now.

    ⛔ Load restaurant tenders

    Request:

    {
      "action": "load_restaurant_tenders",
      "payload": {
      }
    }
    

    Response (200):

    [
      {
        "id": "CASH",
        "label": "Test CASH",
        "tip": true,
        "requires_verified_user": true,
        "requires_logged_in_user": true
      }
    ]
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing"
    }
    

    Load all tenders from restaurant filtered by channel, integration.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "load_restaurant_tenders" action will be provided here
    payload: { empty payload
    }

    Response Body

    Field Type Description
    [
       {
         id string tender id
         label string tender label
         tip boolean
         requires_verified_user boolean requires a verified user
         requires_logged_in_user boolean requires a verified user
       }
    ]

    ⛔ Get User Points (Zuppler Points)

    Request:

    {
      "action": "get_user_points",
      "payload": {}
    }
    

    Response (200):

    {
      "points": 100
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Get user points.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "get_user_points" action will be provided here
    payload: { }

    Response Body

    Field Type Description
    points integer User Points for a particular Restaurant

    ⛔ Get User Transaction (Zuppler Points)

    Request:

    {
      "action": "get_user_transactions",
      "payload": {
        "limit" : 100
      }
    }
    

    Response (200):

    [
       {
         "date": "2018-11-01 14:20:41.162439",
         "id": 688,
         "order_uuid": "UUID",
         "points": 100,
         "restaurant_id": 4497,
         "rule_description": "This is a Sample Earning Rule",
         "transaction_message": "$12.0 order placed on 2018-11-01 for DELIVERY. 100",
         "user_id": 531592
       }
     ]
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    

    Get user points.

    HTTP Request

    POST cart_url (url will be provided on create cart)

    Request Parameters

    Parameter Type Required Description
    action String true "get_user_transactions" action will be provided here
    payload: {
    limit integer true Limit of Transaction to be loaded
    }

    Response Body

    Field Type Description
    id integer Id of Transaction
    order_uuid String order UUID
    points integer Points Granted/Revoked for a particular order
    restaurant_id integer Restaurant ID of Order
    rule_description string Rule Description of Earning/Spending Rule
    transaction_message string Transaction Message
    user_id integer User ID
    date date Date-Time of Transaction

    ⛔ Inject order in Zuppler

    Request (SCHEDULE + DELIVERY):

    {
      "channel_id": "zuppler",
      "integration_url": "http://www.zuppler.com",
      "restaurant_id": 111,
      "integration_remote_id": "levelup",
      "customer": {
        "name": "Test Name",
        "email": "test@zuppler.com",
        "phone": "0123456789"
      },
      "address": {
        "block": "Ap 12",
        "city": "Conshohocken",
        "complete_address": "738 E Elm St, Conshohocken, PA 19428, USA",
        "country": "United States",
        "cross_street": "232",
        "delivery_instructions": "Call the phone",
        "lat": 30.410329,
        "lng": 87.2139,
        "nickname": "Zuppler Office",
        "precision": 5,
        "state": "PA",
        "street": "730 East Elm Street",
        "zip": "32502"
      },
      "order": {
        "type": "DELIVERY"
      },
      "time": {
        "type": "SCHEDULE",
        "value": "2018-04-16T13:08:50"
      },
      "tip": {
        "type": "PERCENT",
        "value": 10.0
      },
      "items": [
        {
          "id": 1,
          "quantity": 3,
          "comments": "No spicy",
          "modifiers": [
            {
              "id": 12121,
              "quantity": 2
             }
           ]
        },
        {
          "id": 2,
          "quantity": 2,
          "comments": "Extra sauce",
          "modifiers": [
            {
              "id": 1222,
              "quantity": 12
             }
           ]
        }
      ],
      "order_comments": "This is a comment",
      "tender": {
        "type": "LevelUp"
      }
    }
    

    Request (ASAP + PICKUP):

    {
      "channel_id": "zuppler",
      "integration_url": "http://www.zuppler.com",
      "restaurant_id": 111,
      "integration_remote_id": "levelup",
      "customer": {
        "name": "Test Name",
        "email": "test@zuppler.com",
        "phone": "0123456789"
      },
      "order": {
        "type": "PICKUP"
      },
      "time": {
        "type": "ASAP"
      },
      "tip": {
        "type": "AMOUNT",
        "value": 5.5
      },
      "items": [
        {
          "id": 1,
          "quantity": 3,
          "comments": "No spicy",
          "modifiers": [
            {
              "id": 12121,
              "quantity": 2
             }
           ]
        },
        {
          "id": 2,
          "quantity": 2,
          "comments": "Extra sauce",
          "modifiers": [
            {
              "id": 1222,
              "quantity": 12
             }
           ]
        }
      ],
      "order_comments": "This is a comment",
      "tender": {
        "type": "LevelUp"
      }
    }
    

    Response (200):

    {
      "url": "order url",
      "totals": {
        "subtotal": 11.19,
        "savings": 0.0,
        "tax": 7.84,
        "tip": 0.0,
        "service": 0.0,
        "delivery": 0.0,
        "total": 19.65
      },
      "time": "2018-04-16T13:08:50"
    }
    

    Response (400 Bad Request):

    {
        "message": "Customer email is invalid"
    }
    

    Inject order into Zuppler.

    HTTP Request

    POST /v5/inject_order

    Request Parameters

    Parameter Type Required Description

    Response Body

    Field Type Description

    ⛔ Load channel details

    Load channels details.

    TODO

    ⛔ Validate cart

    Final call to validate the whole cart.

    TODO

    Loyalty API

    Staging: zuppler-points.biznettechnologies.com

    Production: zuppler-points.zuppler.com

    Get Earning Rules

    curl "http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/earning_rules"
    
    {}
    

    Response (200):

    [
      {
        "description": "This is a Sample Earning Rule",
        "earning_type": "multiplier",
        "id": 18,
        "name": "Earning Rule 1",
        "restaurant_id": 1,
        "value": 1.5
      }
    ]
    
    [
      {
        "description": "This is a Sample Earning Rule",
        "earning_type": "multiplier",
        "id": 18,
        "name": "Earning Rule 1",
        "restaurant_id": 1,
        "value": 1.5
      }
    ]
    

    This endpoint returns List of all Earning Rules for a particular Restaurant.

    HTTP Request

    GET v5/restaurants/:restaurant_id/earning_rules

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of Restaurant

    Response Body

    Field Type Description
    restaurant_id integer Restaurant ID
    earning_type integer earning type (Total or Multiplier)
    value float Points value or Multiplier Value
    name string name of the rule
    id integer ID of the Earning Rule
    description string description of the rule

    Create Earning Rule

    curl -X POST http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/earning_rules --data '{"value": 1.5, "name": "Earning Rule 1", "description": "This is a Sample Earning Rule", "earning_type": "multiplier"}' -H "Content-Type: application/json"
    
    {
      "description": "This is a Sample Earning Rule",
      "earning_type": "multiplier",
      "name": "Earning Rule 1",
      "value": 100
    }
    

    Response (200):

    {
      "description": "This is a Sample Earning Rule",
      "earning_type": "multiplier",
      "id": 18,
      "name": "Earning Rule 1",
      "restaurant_id": 1,
      "value": 1.5
    }
    
    {
      "description": "This is a Sample Earning Rule",
      "earning_type": "multiplier",
      "id": 18,
      "name": "Earning Rule 1",
      "restaurant_id": 1,
      "value": 1.5
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    
    {
        "message": "Required parameters are missing."
    }
    

    Response (422):

    {
      "message": [
        "earning_type is invalid"
      ]
    }
    
    {
      "message": [
        "earning_type is invalid"
      ]
    }
    

    This endpoint creates Earning Rule for a particular Restaurant.

    HTTP Request

    POST v5/restaurants/:restaurant_id/earning_rules

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of Restaurant
    value float true Points/Mutliplier to be earned
    earning_type string true Points/Multipler
    name string true name of Restaurant
    description string true description of Restaurant

    Response Body

    Field Type Description
    restaurant_id integer Restaurant ID
    earning_type string Points/Mutliper
    value float Points multipler (e.g. 1.5X)
    name string name of the rule
    id integer ID of the Earning Rule
    description string description of the rule

    Update Earning Rule

    HTTP Request

    PUT v5/restaurants/:restaurant_id/earning_rules/:rule_id

    curl -X PUT http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/earning_rules/:rule_id -d '{"value": 2.5, "name": "Earning Rule", "description": "This is a Sample Earning Rule", "earning_type": "multiplier"}' -H "Content-Type: application/json"
    
    {
      "description": "This is a New Earning Rule",
      "earning_type": "multiplier",
      "name": "Earning Rule 1",
      "value": 2.5
    }
    

    Response (200):

    {
       "id" : 21,
       "name" : "Earning Rule 1",
       "description" : "This is a New Earning Rule",
       "value" : 2.5,
       "restaurant_id" : 1,
       "earning_type" : "multiplier"
    }
    
    {
       "id" : 21,
       "name" : "Earning Rule 1",
       "description" : "This is a New Earning Rule",
       "value" : 2.5,
       "restaurant_id" : 1,
       "earning_type" : "multiplier"
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    
    {
        "message": "Required parameters are missing."
    }
    

    Response (422):

    {
       "message" : [
          "value must be greater than 0"
       ]
    }
    
    {
       "message" : [
          "value must be greater than 0"
       ]
    }
    

    This endpoint updates Earning Rule for a particular Restaurant.

    Request Parameters

    Parameter Type Required Description
    id integer true id of Rule
    restaurant_id integer true id of Restaurant
    points integer optional Points to be earned
    multiplier float optional Points Multipler
    name string optional name of Restaurant
    description string optional description of Restaurant

    *Note: Only Points or Multipler can be present at once.

    Response Body

    Field Type Description
    restaurant_id integer Restaurant ID
    points integer points to earn
    multiplier float Points multipler (e.g. 1.5X)
    name string name of the rule
    id integer ID of the Earning Rule

    Delete Earning Rule

    DELETE v5/restaurants/:restaurant_id/earning_rules

    curl -X DELETE http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/earning_rules/:rule_id
    
    {}
    

    Response (200):

    {}
    
    {}
    

    Response (422):

    {
       "message" : [
          "No Rule with ID 123"
       ]
    }
    
    {
       "message" : [
          "No Rule with ID 123"
       ]
    }
    

    This endpoint deletes Earning Rule for a particular Restaurant.

    Request Parameters

    Parameter Type Required Description
    id integer true id of Rule
    restaurant_id integer true id of Restaurant

    Get Spending Rules

    {}
    
    curl "http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/spending_rules"
    

    Response (200):

    [
      {
        "restaurant_id": 1,
        "points": 100,
        "name": "Spending Reward",
        "id": 1,
        "description": "Get $10 off by using 100 Points",
        "amount": 10
      }
    ]
    
    [
      {
        "restaurant_id": 1,
        "points": 100,
        "name": "Spending Reward",
        "id": 1,
        "description": "Get $10 off by using 100 Points",
        "amount": 10
      }
    ]
    

    This endpoint returns List of all spending rules for a particular Restaurant.

    HTTP Request

    GET v5/restaurants/:restaurant_id/spending_rules

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true id of Restaurant

    Response Body

    Field Type Description
    id integer ID of the Spending Rule
    restaurant_id integer Restaurant ID
    points integer Minimun points required
    amount integer Discount Amount
    name string name of the rule
    description string description of the rule

    Create Spending Rule

    curl -X POST http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/spending_rules -d  '{"points": 100, "amount": 10, "name": "Spending Rule", "description": "description"}' -H "Content-Type: application/json"
    
    {
      "amount": 10,
      "description": "description",
      "name": "Spending Rule",
      "points": 100,
      "restaurant_id": 1
    }
    

    Response (200):

    {
      "amount": 10,
      "description": "Get $10 off by using 100 Points",
      "id": 6,
      "name": "Spending Rule",
      "points": 100,
      "restaurant_id": 1
    }
    
    {
      "amount": 10,
      "description": "Get $10 off by using 100 Points",
      "id": 6,
      "name": "Spending Rule",
      "points": 100,
      "restaurant_id": 1
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    
    {
        "message": "Required parameters are missing."
    }
    

    POST v5/restaurants/:restaurant_id/spending_rules

    This endpoint creates Spending Rule for a particular Restaurant.

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true Restaurant ID
    spending_rule_id integer true Spending Rule's ID
    points integer true Loyalty Points
    amount integer true Amount as Discount
    name string true Rule Name
    description string true Rule description

    Response Parameters

    Parameter Type Required Description
    restaurant_id integer true Restaurant ID
    id integer true ID of Rule
    points integer true Loyalty Points
    amount integer true Amount as Discount
    name string true Rule Name
    description string true Rule description

    Update Spending Rule

    curl -X PUT http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/spending_rules/:spending_rule_id -d '{"points":"100", "amount":"10", "name":"Update Rule Name", "description":"Updated Description"}' -H "Content-Type: application/json"
    
    {
      "amount": "10",
      "description": "Updated Description",
      "name": "Update Rule Name",
      "points": "100"
    }
    

    Response (200):

    {
      "amount": 10,
      "description": "Updated Description",
      "id": 5,
      "name": "Update Rule Name",
      "points": 100,
      "restaurant_id": 1
    }
    
    {
      "amount": 10,
      "description": "Updated Description",
      "id": 5,
      "name": "Update Rule Name",
      "points": 100,
      "restaurant_id": 1
    }
    

    Response (400 Bad Request):

    {
        "message": "Required parameters are missing."
    }
    
    {
        "message": "Required parameters are missing."
    }
    

    PUT v5/restaurants/:restaurant_id/spending_rules/:spending_rule_id

    This endpoint updates Spending Rule for a particular Restaurant.

    Request Parameters

    Parameter Type Required Description
    restaurant_id integer true Restaurant ID
    spending_rule_id integer true Spending Rule's ID
    points integer optional Loyalty Points
    amount integer optional Amount as Discount
    name string optional Rule Name
    description string optional Rule description

    Response Parameters

    Parameter Type Required Description
    restaurant_id integer true Restaurant ID
    id integer true ID of Rule
    points integer true Loyalty Points
    amount integer true Amount as Discount
    name string true Rule Name
    description string true Rule description

    Delete Spending Rule

    curl -X DELETE http://zuppler-points.zuppler.com/v5/restaurants/:restaurant_id/spending_rules/:spending_rule_id
    
    {}
    

    Response (200):

    {}
    
    {}
    

    /v5/restaurants/:restaurant_id/spending_rules/:spending_rule_id

    This endpoint deletes Spending Rule for a particular Restaurant.

    Request Parameters

    Parameter Type Required Description
    spending_rule_id integer true id of Rule
    restaurant_id integer true id of Restaurant

    Feedback API

    Staging: https://zuppler-feedback-api-staging.herokuapp.com

    Production: https://zuppler-feedback-api-prod.herokuapp.com

    ✅ Create feedback session

    Request:

    {
      "order": {
        "id": "100",
        "locale": "en",
        "items": [
          {
            "name": "Item 1"
          },
          {
            "name": "Item 2"
          }
        ],
        "client": {
          "id": "1",
          "name": "Client name"
        },
        "customer": {
          "name": "Customer name",
          "email": "customer@email.com"
        }
      }
    }
    
    

    Response (200): # initial, no ratings

    {
        "feedback": {
            "session": {
                "id": 2309812,
                "client_id": 1,
                "expire": "2018-03-05T12:21:24.321Z",
                "locale": "en",
                "average": "0.0",
                "closed": false,
                "created_at": "2018-02-26T12:21:24.322Z",
                "updated_at": "2018-02-26T12:21:24.322Z"
            },
            "subjects": [
                {
                    "id": 287025,
                    "type": "review",
                    "name": "Client name",
                    "description": null,
                    "min": 1,
                    "max": 5
                },
                {
                    "id": 287026,
                    "type": "item",
                    "name": "Item 1",
                    "description": null,
                    "min": 1,
                    "max": 2
                },
                {
                    "id": 287027,
                    "type": "item",
                    "name": "Item 2",
                    "description": null,
                    "min": 1,
                    "max": 2
                }
            ],
            "ratings": [],
            "links": [
                {
                    "name": "rating",
                    "method": [
                      "post"
                    ],
                    "url": "http://localhost:3000/api/sessions/2309809/ratings"
                }
            ]
          }
    }
    

    Response (200): # with ratings

    {
        "feedback": {
            "session": {
                "id": 2309809,
                "client_id": 1,
                "expire": "2018-03-04T19:48:01.922Z",
                "locale": "en"
            },
            "subjects": [
                {
                    "id": 287020,
                    "type": "item",
                    "name": "Item 1",
                    "description": null,
                    "min": 1,
                    "max": 2
                },
                {
                    "id": 287021,
                    "type": "item",
                    "name": "Item 2",
                    "description": null,
                    "min": 1,
                    "max": 2
                }
            ],
            "ratings": [
                {
                    "subject_id": 287020,
                    "id": 434263,
                    "status": null,
                    "score": 2,
                    "comment": null
                },
                {
                    "subject_id": 287021,
                    "id": 434264,
                    "status": null,
                    "score": 2,
                    "comment": "Loved it"
                }
            ],
            "links": [
                {
                    "name": "rating",
                    "method": [
                      "post"
                    ],
                    "url": "http://localhost:3000/api/sessions/2309809/ratings"
                }
            ]
    
        }
    }
    

    Response (422):

    {
        "error": "invalid params"
    }
    

    Create feedback session

    HTTP Request

    POST /api/sessions

    Request Parameters

    Parameter Type Required Description
    id string true id of the order
    locale string false locale for session and subjects
    items list true list of item names
    client list true client data: id & name
    customer list true customer data: name & email

    Response Body

    Field Type Description
    session list session data: id, client_id, expire, locale
    subjects list subjects data, for each: id, name, description, min, max
    ratings list ratings data, for each: subject_id, id, score, comment

    ✅ Load feedback sessions

    Request:

    {
      "access_token": "dasdasd21131",
      "page": {
        "size": "15",
        "number": "0"
      },
      "filters": {
        "closed": "true",
        "archived": "true"
      }
    }
    

    Response (200):

    {
      "sessions":
        [
          {
            "id":1,
            "name":"testing 1",
            "average":"0.0",
            "expire":"2018-03-02T18:55:50.213Z",
            "created_at":"2018-02-23T18:55:50.213Z",
            "updated_at":"2018-02-23T18:55:50.213Z",
            "closed":false,
            "context_id":"1",
            "customer_email":"1",
            "client_id":"1",
            "client_name":"1",
            "customer_name":"1",
            "locale":"en",
            "archived":false,
            "database_id":null,
            "channel_id":null,
            "comment":"I like zuppler",
            "score":"4"
         },
         {
            "id":2,
            "name":"testing 2",
            "average":"0.0",
            "expire":"2018-03-02T18:55:50.217Z",
            "created_at":"2018-02-23T18:55:50.217Z",
            "updated_at":"2018-02-23T18:55:50.217Z",
            "closed":"false",
            "context_id":"2",
            "customer_email":"2",
            "client_id":2,
            "client_name":"2",
            "customer_name":"2",
            "locale":"en",
            "archived":"false",
            "database_id":"null",
            "channel_id":"null",
            "comment":"this is a test",
            "score":"1"
         }
      ]
    }
    

    Response (404):

    {
      "error": "sessions not found"
    }
    

    Load feedback sessions

    HTTP Request

    POST /api/reports/sessions

    Request Parameters

    Parameter Type Required Description
    access_token string true Zuppler::User access_token
    page list false list for pagination params (size - number of session per page, number - page number), default values: size: 10, number: 0
    filters list false list of filters for session list, allowed filters: closed, archived

    Response Body

    Parameter Type Description
    sessions list List of sessions(restricted by user role), with all attributes + comment and score attributes from rating of review

    ⛔ Load feedback session

    Request:

    {
      "access_token": "dasdasd21131"
    }
    

    Response (200):

    [{
      "session": {
        "id": 3,
        "name": "testings",
        "average": "0.0",
        "expire": "2018-03-03T14:40:32.273Z",
        "created_at": "2018-02-24T14:40:32.273Z",
        "updated_at": "2018-02-24T14:40:32.273Z",
        "closed": false,
        "context_id": "3",
        "client_id": 0,
        "client_name": "3",
        "locale": "en",
        "archived": false,
        "database_id": null,
        "channel_id": null,
        "customer": {
          "name": "3",
          "email": "3"
        }
      },
      "subjects": [{
        "id": 1,
        "type": "demo",
        "name": "Subject Demo",
        "description": null,
        "average": "0.0",
        "rates": 0,
        "score": 0,
        "created_at": "2018-02-24T14:40:32.269Z",
        "updated_at": "2018-02-24T14:40:32.269Z",
        "min": 1,
        "max": 5,
        "client_id": 0,
        "locale": "en",
        "database_id": null,
        "channel_id": null,
        "disabled": false
      }],
      "ratings": [{
        "id": 1,
        "score": 3,
        "comment": null,
        "status": null,
        "created_at": "2018-02-24T14:40:32.306Z",
        "updated_at": "2018-02-24T14:40:32.306Z",
        "session_id": 3,
        "subject_id": 1,
        "database_id": null
      }]
    }]
    

    Response (????):

    Load feedback session

    HTTP Request

    POST /api/reports/sessions/:id

    Request Parameters

    Parameter Type Required Description
    access_token string true Zuppler::User access_token

    ✅ Archive feedback session

    Request:

    {
      "access_token": "dasdasd21131",
      "archived": "true"
    }
    

    Response (200):

    Response (422):

    {
      "error": "session update fail"
    }
    

    Archive feedback session

    HTTP Request

    PATCH /api/reports/sessions/:id

    Request Parameters

    Parameter Type Required Description
    access_token string true Zuppler::User access_token
    archived boolean true true/false

    ⛔ Create Rating

    Request:

    {
        "rating": {
            "session_id": "2309791",
            "subject_id": "287005",
            "score": "2",
            "comment": "Great"
        }   
    }
    

    Response (201):

    Response (422):

    Create Rating

    Create rating for a session and subject.

    HTTP Request

    POST /api/sessions/:session_id/ratings

    Request Parameters

    Parameter Type Required Description
    session_id string true id of feedback session
    subject_id string true id of subject
    score string true, if subject type != review score for subject
    comment string true, if subject type == review comment for subject

    Response Body

    empty body

    ⛔ Update rating

    Request:

    {
      "rating": {
        "comment":"updated"
      }
    }
    

    Response (200):

    Response (422):

    Update rating

    HTTP Request

    POST /api/sessions/:session_id/ratings

    Request Parameters

    Parameter Type Required Description
    session_id string false id of feedback session
    subject_id string false id of subject
    score string false score for subject
    comment string false comment for subject

    Response Body

    empty body

    ✅ Load item data

    Request:

    {
      "client_id": "1",
      "name": "Item 1",
      "locale": "en"
    }
    

    Response (200):

    {
        "item": {
            "name": "Item 1",
            "rates": 0,
            "average": "0.0",
            "score": 0
        }
    }
    

    Response (200), no item:

    {
        "item": {}
    }
    

    Response (?????):

    Load item data

    HTTP Request

    GET /api/reports/top_items

    Request Parameters

    Parameter Type Required Description
    client_id string true client id for item
    locale string true item locale
    name string true item name

    Response Body

    Parameter Type Description
    list list list of item data

    ✅ Load items data

    Request:

    {
      "client_id":"1",
      "locale": "en"
    }
    

    Response (200):

    {
      "items": [
          {
              "name": "Item 1",
              "rates": 3,
              "average": 1,
              "score": 0
          },
          {
              "name": "Item 2",
              "rates": 4,
              "average": 0.5,
              "score": 0
          }
      ]
    }
    

    Response (200), no items:

    {
      "items": []
    }
    

    Response (?????):

    Load items data

    HTTP Request

    GET /api/reports/top_items/

    Request Parameters

    Parameter Type Required Description
    client_id string true client id for item
    locale string true item locale

    Response Body

    Parameter Type Description
    items list list of items

    Errors

    The Kittn API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request sucks
    401 Unauthorized -- Your API key is wrong
    403 Forbidden -- The kitten requested is hidden for administrators only
    404 Not Found -- The specified kitten could not be found
    405 Method Not Allowed -- You tried to access a kitten with an invalid method
    406 Not Acceptable -- You requested a format that isn't json
    410 Gone -- The kitten requested has been removed from our servers
    418 I'm a teapot
    429 Too Many Requests -- You're requesting too many kittens! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.