As well as every endpoint in the API for find and findAll have params request, In Categories there is one param which is considered special param, this is param is products
, this adds an extra attribute to categories normal request. The normal request and the special request will be compared below in the examples.
Example of normal request:
http://apiv4.ordering.co/v400/en/demo/business/41/categories
[
{
"id": 248,
"business_id": 41,
"name": "Main menu",
"image": "https://res.cloudinary.com/ordering/image/upload/v1490664405/njrzftn3ttjxuvjfscls.jpg",
"rank": 7,
"enabled": true
},
{
"id": 249,
"business_id": 41,
"name": "Dessert",
"image": "https://res.cloudinary.com/ordering/image/upload/v1490664417/tw4sdwufwbrf6th3ytcq.jpg",
"rank": 8,
"enabled": true
}
...
]
Example of special request:
http://apiv4.ordering.co/v400/en/demo/business/41/categories?params=products
[
{
"id": 248,
"business_id": 41,
"name": "Main menu",
"image": "https://res.cloudinary.com/ordering/image/upload/v1490664405/njrzftn3ttjxuvjfscls.jpg",
"rank": 7,
"enabled": true,
"products": [
{
"id": 1292,
"name": "Bird's Nest",
"price": 3,
"description": "",
"images": "https://res.cloudinary.com/ordering2/image/upload/v1523299637/dfqe6rjkdbqvjaibrwn2.jpg",
"sku": null,
"category_id": 248,
"inventoried": false,
"quantity": 0,
"featured": false,
"enabled": true
},
...
]
}
... //if findAll
]
As it can be seen, categories bring the products included with the special param.