---
# System prepended metadata

title: chef APIs

---

# chef APIs

## fields attributes
  - orderId
  - orderNumber
  -  pickupTime
  - deliveryTime
  - expectedDeclineTime
  - readyTime
  - totalPrice
  - type
  - cooking
  - isLate
  
## sort attributes

  - orderId (default, ascending)
  - pickupTime
  - statusTime
  
## filter attributes

- orderId
- orderNumber
- status : filter[status]=1 OR filter[status]=1, 2, 3
- createdOnFrom : Y-m-d 20-12-30
- createdOnTo : Y-m-d 20-12-30
- pickupTimeFrom : Y-m-d 20-12-30
- pickupTimeTo : Y-m-d 20-12-30
- late: 0 or 1

## expand attributes

- status
- label
- code
- comment
- time
- customer
	- name
	- phone
- driver
	- name
	- phone
	- rate
- location
	- latitude
	- longitude
	- address
- dishes
	- name
	- note
	- quantity
	- pricePerDish
	- total
	- variety
	- cookingOptions
		- name
	- customerOptions
		- name
		- quantity
	- addOns
		- adddonId
		- name
		- 
## Pagination

```
X-Pagination-Total-Count: '1593'
X-Pagination-Page-Count: '80'
X-Pagination-Current-Page: '1'
X-Pagination-Per-Page: '20'
Link:
'
<http://chefapi.chefz.local/v1/orders?page=1>; rel=self,
<http://chefapi.chefz.local/v1/orders?page=2>; rel=next,
<http://chefapi.chefz.local/v1/orders?page=80>; rel=last
'
```

## Examples

- **List all orders :** */v1/orders*
	```
	[
	  {
	    "orderId": 396004,
	    "orderNumber": "279964",
	    "pickupTime": 1598375340,
	    "deliveryTime": 1598376600,
	    "expectedDeclineTime": 1598272309,
	    "totalPrice": "525",
	    "type": 1,
	    "cooking": 0
	  },
	  
	]
	```  

- **list all orders with getting related dishes object:**  */v1/orders?expand=dishes*
	```
	[
	  {
	    "orderId": 396004,
	    "orderNumber": "279964",
	    "pickupTime": 1598375340,
	    "deliveryTime": 1598376600,
	    "expectedDeclineTime": 1598272309,
	    "totalPrice": "525",
	    "type": 1,
	    "cooking": 0,
	    "dishes": [
	      {
	        "name": "Lunch Box A - لانش بوكس A",
	        "note": null,
	        "quantity": 7,
	        "pricePerDish": "69",
	        "total": "485",
	        "variety": null,
	        "customerOptions": [
	          {
	            "name": "test 1",
	            "quantity": 1
	          },
	          {
	            "name": "test 2",
	            "quantity": 2
	          }
	        ],
	        "cookingOptions": [
	          {
	            "name": "test 1"
	          }
	        ],
	        "addOns": {
	          "adddonId": 1,
	          "name": "Test Addon"
	        }
	      }
	    ]
	  },
	  
	]
	```
- **List orders with customer's object getting only orderId from fields:** */v1/orders?expand=customer&fields=orderId*
	```
	[
	  {
	    "orderId": 396004,
	    "customer": {
	      "name": "TEST CUSTOMER 11",
	      "phone": "0512345673"
	    }
	  },
	  ...
	]
	```
- **List orders getting customer, driver & status objects getting orderId from order and customer name from the customer's object:** */v1/orders?expand=customer,driver,status&fields=orderId,customer.name*
	```
	[
	  {
	    "orderId": 395771,
	    "status": {
	      "label": "Delivered",
	      "code": 7,
	      "comment": null,
	      "time": 1587864006
	    },
	    "customer": {
	      "name": "Ajlan"
	    },
	    "driver": {
	      "name": "test",
	      "phone": "12345678",
	      "rate": "5",
	      
	    }
	  },
	  {
	    "orderId": 395702,
	    "status": {
	      "label": "Delivered",
	      "code": 7,
	      "comment": null,
	      "time": 1587860265
	    },
	    "customer": {
	      "name": "Aziz"
	    },
	    "driver": null
	  }
	  ...
	]
	```  

- **List new orders (status = 1), between two pickup dates, getting orderId, pickuptime and only status object:** */v1/orders?expand=status&fields=orderId,pickupTime&filter[pickupTimeFrom]=01-10-2019&filter[pickupTimeTo]=01-12-2019&filter[status]=1*
	```
	[
	  {
	    "orderId": 9,
	    "pickupTime": 1496147280,
	    "status": {
	      "label": "Declined",
	      "code": 4,
	      "comment": "العميل طلب يكنسل الطلب",
	      "time": 1496064899
	    }
	  },
	  ...
	]
	```
- **List orders sorted by orderId descending:**  */v1/orders?sort=-orderId*
- **List orders sorted by pickupTime ascending:**  */v1/orders?sort=pickupTime*