Business special requests

Although every existing endpoint in the API has parameter requests to get specific data, as well as limit, offset and params, for business APIs, there are special requests by using the request param params:attribute used to obtain additional data needed.

🚧

Extra parameters for each endpoint and are not part of the same model attributes, only for find and findAll.

The attributes that are used for special requests are listed below:

  • menus.
  • city.
  • reviews.
  • gallery.
  • offers.
  • categories.
  • products.
  • zones.
  • webhook.
  • paymethods.
  • available_drivers_count.

New

  • featured_products
    This response will only contains the featured products.
    example of featured products endpoint
'https://apiv4.ordering.co/v400/en/demo/business?params=featured_products'

📘

A business has attributes linked to this, even if the user request is for a specific set of attributes, these linked attributes will be included in the response which are timezone, open, today, distance, delivery_zone, minimum and delivery_price as shown in the example.

This is an example of making a request by using:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones
{
    "error": false,
    "result": [
        {
            "id": 22,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "distance": 0,
            "delivery_zone": 15,
            "minimum": 1,
            "delivery_price": 2
        },
  	... //if findAll
]
}

🚧

As it can be seen in the request example the request contains params=zone because is required to make this request with location or dropdown option.

Menus

This param is used to obtain the business menus, including categories and products for each business.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,menus
{
    "error": false,
    "result": [
        {
            "id": 22,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "categories": [
                {
                    "id": 119,
                    "business_id": 22,
                    "name": "Duvets",
                    "image": "https://res.cloudinary.com/ordering2/image/upload/v1539099366/fwwwe75rlmyafmhfb1tj.png",
                    "rank": 5,
                    "enabled": true,
                    "products": [
                        {
                            "id": 549,
                            "name": "Feather Duvet (Double)",
                            "price": 30,
                            "description": "",
                            "images": "https://res.cloudinary.com/ordering/image/upload/v1534196792/m0l3ziafcmysyrig0awl.jpg",
                            "sku": null,
                            "category_id": 119,
                            "inventoried": false,
                            "quantity": 0,
                            "featured": false,
                            "enabled": true,
                            "extras": [],
                            "gallery": [],
                            "ingredients": []
                        },
  	... //if findAll
]
}

City

This param is used to obtain the business city.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,city
{
    "error": false,
    "result": [
        {
            "id": 22,
            "timezone": "America/New_York",
            "city_id": 1,
            "open": false,
            "today": null,
            "distance": 0,
            "delivery_zone": 15,
            "minimum": 1,
            "delivery_price": 2,
            "city": {
                "id": 1,
                "name": "New York",
                "country_id": 1,
                "administrator_id": 6,
                "enabled": true,
                "country": {
                    "id": 1,
                    "name": "United States",
                    "enabled": true
                }
            }
        },
  ... //if findAll
]
}

Reviews

This param is used to obtain the business reviews

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,reviews
{
    "error": false,
    "result": [
        {
            "id": 7,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "reviews": {
                "reviews": [],
                "quality": 0,
                "delivery": 0,
                "service": 0,
                "package": 0,
                "total": 0
            },
            "distance": 0,
            "delivery_zone": 20,
            "minimum": 5,
            "delivery_price": 0
        },
]
}

Gallery

This param is used to obtain the business gallery items, they can be images or videos.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zone,gallery
{
    "error": false,
    "result": [
        {
            "id": 41,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "distance": 0,
            "delivery_zone": 5,
            "minimum": 0,
            "delivery_price": 1,
            "gallery": [
                {
                    "id": 5,
                    "business_id": 41,
                    "type": 1,
                    "file": "https://res.cloudinary.com/ordering/image/upload/v1490664727/nacy6x0qfid1hut9rjqp.jpg",
                    "video": null,
                    "title": "photo1",
                    "description": null,
                    "created_at": "2018-10-06 18:18:25",
                    "updated_at": "2018-10-06 18:18:25"
                },
                {
                    "id": 8,
                    "business_id": 41,
                    "type": 2,
                    "file": null,
                    "video": "https://www.youtube.com/embed/hnxBRYoz2kQ",
                    "title": "video",
                    "description": null,
                    "created_at": "2018-10-06 18:18:25",
                    "updated_at": "2018-10-06 18:18:25"
                },
                ... // 
    ]
  },
  ... //If findAll
]
}

Offers

This param is used to obtain the business offers.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,offers

📘

This request will show available offers type 1 (Automatic discounts) and type 2 (Coupons).

{
    "error": false,
    "result": [
        {
            "id": 3,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "distance": 0,
            "delivery_zone": 21,
            "minimum": 9,
            "delivery_price": 9,
            "offers": [
                {
                    "id": 12,
                    "business_id": 3,
                    "name": "Demo offer for all businesses",
                    "type": 1,
                    "minimum": 2000,
                    "rate_type": 2,
                    "rate": 5,
                    "start": "2018-03-01 00:00:00",
                    "end": "2019-12-29 00:00:00",
                    "coupon": null
                },
                {
                    "id": 24,
                    "business_id": 3,
                    "name": "test",
                    "type": 2,
                    "minimum": 1,
                    "rate_type": 2,
                    "rate": 10,
                    "start": "2018-11-16 00:00:00",
                    "end": "2018-11-23 00:00:00",
                    "coupon": "test"
                }
            ]
        },
  ... //If findAll
  ]
}

📘

With token access being user Administrator or Business owner it can be used mode:dashboard and params:offers, this contains all offers including all the information as the following example:

  • https://apiv4.ordering.co/v400/en/demo/business/tastewine?mode=dashboard&params=offers
{
  "id": 3,
  "name": "Taste Wine",
  "timezone": "America/New_York",
  "open": false,
  "today": null,
  "valid_service": true,
  "num_zones": 2,
  "distance": null,
  "delivery_zone": 5,
  "minimum": 0,
  "delivery_price": 1,
  "offers": [
            {
                "id": 12,
                "business_id": 3,
                "name": "Demo offer for all businesses",
                "type": 1,
                "minimum": 2000,
                "rate_type": 2,
                "rate": 5,
                "start": "2018-03-01 00:00:00",
                "end": "2019-12-29 00:00:00",
                "coupon": null,
                "limit": 99999,
                "enabled": true
            },
            {
                "id": 24,
                "business_id": 3,
                "name": "test",
                "type": 2,
                "minimum": 1,
                "rate_type": 2,
                "rate": 10,
                "start": "2018-11-16 00:00:00",
                "end": "2018-11-23 00:00:00",
                "coupon": "test",
                "limit": 1,
                "enabled": true
            }
        ],
    ...
  ]
}

Categories

This param is used to obtain the business categories.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,categories
{
  "error": false,
  "result": [
    {
      "id": 7,
      "timezone": "America/New_York",
      "open": false,
      "today": null,
      "distance": 0,
      "delivery_zone": 20,
      "minimum": 5,
      "delivery_price": 0,
      "categories": [
        {
          "id": 97,
          "business_id": 7,
          "name": "Laundry",
          "image": "https://res.cloudinary.com/ordering2/image/upload/v1539099221/yrlnpdo6b2hllgbhrpit.png",
          "rank": 1,
          "enabled": true
        },
        {
          "id": 98,
          "business_id": 7,
          "name": "Shirts",
          "image": "https://res.cloudinary.com/ordering2/image/upload/v1539099223/awelrxjbmlgbyxn5gxdk.png",
          "rank": 2,
          "enabled": true
        },
        ... //all the categories
      ]
        },
        ... // if findAll
      ]
    }

Products

This param is used to obtain the business products including the categories information.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?type=1&location=36.1315455,-95.9664416&params=zones,products
{
    "error": false,
    "result": [
        {
            "id": 7,
            "name": "Twirly Laundry",
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "distance": 0,
            "delivery_zone": 20,
            "minimum": 5,
            "delivery_price": 0,
            "categories": [
                {
                    "id": 97,
                    "business_id": 7,
                    "name": "Laundry",
                    "image": "https://res.cloudinary.com/ordering2/image/upload/v1539099221/yrlnpdo6b2hllgbhrpit.png",
                    "rank": 1,
                    "enabled": true,
                    "products": [
                        {
                            "id": 488,
                            "name": "Dress (Everyday)",
                            "price": 11,
                            "description": "",
                            "images": "https://res.cloudinary.com/ordering/image/upload/v1534166759/cy89045kwlzzur3fmvea.png",
                            "sku": null,
                            "category_id": 97,
                            "inventoried": false,
                            "quantity": 0,
                            "featured": false,
                            "enabled": true,
                            "category": {
                                "id": 97,
                                "business_id": 7,
                                "name": "Laundry",
                                "image": "https://res.cloudinary.com/ordering2/image/upload/v1539099221/yrlnpdo6b2hllgbhrpit.png",
                                "rank": 1,
                                "enabled": true
                            },
                            "extras": [],
                            "gallery": [],
                            "ingredients": []
                        },
                    ....
              ]
          }
        ],
        "distance": 0,
        "delivery_zone": 21,
        "minimum": 9,
        "delivery_price": 9,
        
    }
   ... // if findAll
]
}

📘

Using params:products also brings categories, because the products are included in categories.

Zones

This param is used to obtain the business zones.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business?mode=dashboard&params=zones,name
{
    "error": false,
    "result": [
        {
            "id": 3,
            "timezone": "America/New_York",
            "open": false,
            "today": null,
            "zones": [
                {
                    "id": 21,
                    "business_id": 3,
                    "name": "Whole World Taste Wine",
                    "type": 1,
                    "address": "5th avenue",
                    "data": {
                        "center": {
                            "lat": 40.75556566433035,
                            "lng": -75.69638585678427
                        },
                        "radio": 19918.492520125288
                    },
                    "dropdown_option_id": null,
                    "price": 9,
                    "minimum": 9,
                    "schedule": [],
                    "enabled": true
                }
            ]
        },
  	... //if findAll
]
}

Webhooks

This param is used to obtain the business webhooks.

  • An example to use this param is:
    https://apiv4.ordering.co/v400/en/demo/business/tastewine?params=zones,name,webhooks

🚧

This params only works with find not with findAll

{
    "id": 3,
    "timezone": "America/New_York",
    "open": false,
    "today": null,
    "valid_service": false,
    "webhooks": [
        {
            "id": 1,
            "business_id": 3,
            "hook": "orders_update_driver",
            "url": "https://dash.readme.io/project/ordering/v4.0/refs/business-special-requests"
        },
        {
            "id": 2,
            "business_id": 3,
            "hook": "orders_register",
            "url": "https://dash.readme.io/project/ordering/v4.0/refs/business-special-requests"
        }
    ]
}

Paymethods

This param is used to obtain the business payment methods paymethods.

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business/3?params=paymethods

🚧

This params only works with find not with findAll

{
    "id": 3,
    "timezone": "America/New_York",
    "open": false,
    "today": null,
    "valid_service": false,
    "paymethods": [
        {
            "id": 6,
            "paymethod_id": 1,
            "business_id": 3,
            "sandbox": false,
            "enabled": true,
            "created_at": "2018-07-02 18:04:00",
            "updated_at": "2018-07-02 18:04:00",
            "data": {},
            "paymethod": {
                "id": 1,
                "name": "Cash",
                "gateway": "cash",
                "enabled": true,
                "deleted_at": null,
                "created_at": "2018-07-02 18:04:00",
                "updated_at": "2018-07-02 18:04:00"
            }
        },
      ...
    ]
}

Available Drivers

This param is used to obtain the Available Drivers (Number) .

An example to use this param is:

  • https://apiv4.ordering.co/v400/en/demo/business/3?params=available_drivers_count

🚧

This params works with:

Find Business
Get Business List
Get Advance Search

📘

What drivers are available for the business?

The drivers (Users) have the following attributes:

  • busy
  • enabled
  • available

You can check this in the Users Model Section.
A driver is idle when he has the following values in these attributes:

  • enabled: true
  • available: true
  • busy: false

A driver is busy when he has the following values in these attributes:

  • enabled: true
  • available: true
  • busy: true
{
    "id": 3,
    "timezone": "America/New_York",
    "open": false,
    "today": null,
    "valid_service": false,
    "idle_drivers_count": 0,
    "busy_drivers_count": 2
}