Although every existing endpoint in the API has params requests to get specific data, as well as limit
, offset
and params
, for orders, there are special requests by using the request param params: attribute
used to obtain 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:
- Paymethod.
- Products.
- Driver.
- Review.
- Attachments.
- History.
- Business.
- Customer.
Paymethods
This param is used to obtain the orders payment method with the paymethods
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=paymethod_id,paymethods
To use
params:paymethod
is required to useparams:paymethod_id
to obtain the desired response as shown in the example.
[
{
"id": 10,
"paymethod_id": 1,
"paymethod": {
"id": 1,
"name": "Cash",
"gateway": "cash",
"enabled": true,
"deleted_at": null,
"created_at": "2018-07-19 16:20:54",
"updated_at": "2018-07-19 16:20:54"
}
}
...
]
Products
This param is used to obtain the orders products with the products
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=products
[
{
"id": 10,
"products": [
{
"id": 11,
"product_id": 1319,
"order_id": 10,
"name": "Chipotle BBQ Snack Wrap (Grilled or Crispy)",
"price": 25,
"quantity": 3,
"comment": null,
"ingredients": [],
"options": [
{
"id": 53,
"name": "Size",
"suboptions": [
{
"id": 173,
"name": "large",
"price": 3
}
]
},
...
]
}
]
}
]
Driver
This param is used to obtain the driver's information assigned to the orders with the driver
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=driver_id,driver
Params
driver_id
is required whendriver
is used. The driver id is part of the order and can be used to expand the driver information and show the driver details.
[
{
"id": 37,
"driver_id": 6,
"driver": {
"id": 6,
"name": "Driver",
"lastname": "Demo",
"email": "[email protected]",
"login_type": 0,
"social_id": null,
"photo": null,
"birthdate": null,
"phone": null,
"cellphone": "3314567834",
"city_id": null,
"dropdown_option_id": null,
"address": "5th avenue",
"address_notes": null,
"zipcode": "",
"location": {
"lat": 10.9415788,
"lng": -74.7726246
},
"level": 4,
"language_id": 1,
"push_notifications": true,
"busy": false,
"available": true,
"enabled": true,
"created_at": "2018-07-19 16:20:17",
"updated_at": "2018-07-25 16:40:35",
"deleted_at": null
}
},
...
]
Review
This param is used to obtain orders reviews with the review
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=review
[
{
"id": 58,
"review": {
"id": 1,
"order_id": 58,
"quality": 4,
"delivery": 4,
"service": 2,
"package": 5,
"user_id": 1,
"comment": "coment test",
"enabled": true,
"created_at": "2018-07-27 19:41:57",
"updated_at": "2018-07-27 19:41:57"
}
},
...
]
Attachments
This param is used to obtain orders attachments with the attachments
attribute. The attachments can be for example images, signatures, notes and comments.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=attachmets
[
{
"id": 54,
"attachments": [
{
"id": 7,
"order_id": 54,
"user_id": 1,
"type": 3,
"file": "https://res.cloudinary.com/ordering/image/upload/v1532722544/xul5jssxomh348epkc3s.png",
"note": null,
"created_at": "2018-07-27 20:15:44",
"updated_at": "2018-07-27 20:15:44"
},
{
"id": 8,
"order_id": 54,
"user_id": 1,
"type": 1,
"file": null,
"note": "I'm confused with the destination address",
"created_at": "2018-07-27 20:15:53",
"updated_at": "2018-07-27 20:15:53"
},
...
]
},
...
]
History
This param is used to obtain the orders timeline with the history
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=history
[
{
"id": 54,
"history": [
{
"id": 45,
"order_id": 54,
"type": 1,
"data": null,
"created_at": "2018-07-20 17:44:38",
"updated_at": "2018-07-20 17:44:38"
},
{
"id": 59,
"order_id": 54,
"type": 2,
"data": [
{
"attribute": "status",
"old": 0,
"new": 8
}
],
"created_at": "2018-07-27 20:15:35",
"updated_at": "2018-07-27 20:15:35"
},
...
]
}
... //if findAll
]
Business
This param is used to obtain orders business information with the business
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=business
[
{
"id": 54,
"business": {
"id": 52,
"order_id": 54,
"name": "McBonalds",
"logo": "https://res.cloudinary.com/ordering2/image/upload/v1523379984/vymo7gxbk73mms4kyz5l.jpg",
"email": "[email protected]",
"city_id": 1,
"address": "160 Broadway",
"address_notes": null,
"zipcode": null,
"cellphone": "123123123123",
"phone": "123123",
"location": "{\"lat\":40.7127837,\"lng\":-74.00594130000002,\"zipcode\":-1,\"zoom\":15}",
"city": {
"id": 1,
"name": "New York",
"country_id": 1,
"administrator_id": 4,
"enabled": true
}
}
}
... //if findAll
]
Customer
This param is used to obtain orders customer information with the customer
attribute.
An example to use this param is:
https://apiv4.ordering.co/v400/en/demo/orders?params=customer
[
{
"id": 2,
"customer": {
"id": 2,
"order_id": 2,
"name": "Demo",
"photo": null,
"lastname": "Admin",
"email": "[email protected]",
"dropdown_option_id": null,
"address": "500 5th Ave, New York, NY 10110, USA",
"address_notes": "15",
"zipcode": "10001",
"cellphone": "33183467364",
"phone": "2332223",
"location": "\"{\\\"lat\\\":40.7539143,\\\"lng\\\":-73.9810162}\"",
"dropdown_option": null
}
},
//... if find all
]