# Delivery Orders

## Retrieving site orders

> Get orders for given site and tenant<br>

```json
{"openapi":"3.0.0","info":{"title":"Delivery Service","version":"0.0.1"},"tags":[{"name":"Delivery Orders"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":[]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{}}}}},"schemas":{"OrderDTOList":{"type":"array","items":{"$ref":"#/components/schemas/OrderDTO"}},"OrderDTO":{"type":"object","properties":{"id":{"type":"string"},"siteCode":{"type":"string"},"task":{"$ref":"#/components/schemas/Task"},"taskId":{"type":"string"},"contactPhone":{"type":"string"},"mobilePhone":{"type":"string"},"orderStatus":{"$ref":"#/components/schemas/OrderStatus"},"orderNumber":{"type":"string"},"hint":{"type":"string"},"deliveryTime":{"$ref":"#/components/schemas/DeliveryTime"},"pickup":{"type":"boolean"},"pickupAddress":{"$ref":"#/components/schemas/PickupAddress"},"shippingAddress":{"$ref":"#/components/schemas/ShippingAddress"},"deliveryHoldingTime":{"type":"number"},"personalHandover":{"type":"boolean"}}},"Task":{"type":"object","properties":{"taskId":{"type":"string"},"trackingURL":{"type":"string"},"deliveryProvider":{"$ref":"#/components/schemas/DeliveryProvider"},"status":{"type":"string","enum":["CREATED","CANCELLED"]}}},"DeliveryProvider":{"type":"string","enum":["VELOCE","ONFLEET"]},"OrderStatus":{"type":"string","enum":["IN_CHECKOUT","CREATED","CONFIRMED","DECLINED","SHIPPED","COMPLETED"]},"DeliveryTime":{"type":"object","properties":{"deliveryDate":{"type":"string","format":"date"},"deliveryTimeFrom":{"type":"string","format":"time"},"deliveryTimeTo":{"type":"string","format":"time"},"deliveryCosts":{"type":"number"},"pickupSettings":{"type":"string"}}},"PickupAddress":{"type":"object","properties":{"id":{"type":"string"},"street":{"type":"string"},"streetNumber":{"type":"string"},"city":{"type":"string"},"zipCode":{"type":"string"},"companyName":{"type":"string"},"country":{"type":"string"},"addressName":{"type":"string"},"description":{"type":"string"},"addressTag":{"type":"string"}}},"ShippingAddress":{"type":"object","properties":{"contactName":{"type":"string"},"companyName":{"type":"string"},"street":{"type":"string"},"streetNumber":{"type":"string"},"streetAppendix":{"type":"string"},"extraLine1":{"type":"string"},"extraLine2":{"type":"string"},"extraLine3":{"type":"string"},"extraLine4":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"state":{"type":"string"},"contactPhone":{"type":"string"},"mixins":{"type":"object","additionalProperties":true}}},"ErrorMessage":{"required":["message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"}}}}}}}}},"responses":{"BadRequest_400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}}}},"paths":{"/delivery-v2/{tenant}/order":{"get":{"summary":"Retrieving site orders","description":"Get orders for given site and tenant\n","parameters":[{"name":"tenant","in":"path","required":true,"schema":{"type":"string"}},{"name":"siteCode","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Resource successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderDTOList"}}}},"400":{"$ref":"#/components/responses/BadRequest_400"},"401":{"$ref":"#/components/responses/Unauthorized_401"}},"operationId":"GET-delivery-list-orders","tags":["Delivery Orders"]}}}}
```

## Retrieving an order

> Get order by a given orderId and tenant.<br>

```json
{"openapi":"3.0.0","info":{"title":"Delivery Service","version":"0.0.1"},"tags":[{"name":"Delivery Orders"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":[]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{}}}}},"schemas":{"OrderDTO":{"type":"object","properties":{"id":{"type":"string"},"siteCode":{"type":"string"},"task":{"$ref":"#/components/schemas/Task"},"taskId":{"type":"string"},"contactPhone":{"type":"string"},"mobilePhone":{"type":"string"},"orderStatus":{"$ref":"#/components/schemas/OrderStatus"},"orderNumber":{"type":"string"},"hint":{"type":"string"},"deliveryTime":{"$ref":"#/components/schemas/DeliveryTime"},"pickup":{"type":"boolean"},"pickupAddress":{"$ref":"#/components/schemas/PickupAddress"},"shippingAddress":{"$ref":"#/components/schemas/ShippingAddress"},"deliveryHoldingTime":{"type":"number"},"personalHandover":{"type":"boolean"}}},"Task":{"type":"object","properties":{"taskId":{"type":"string"},"trackingURL":{"type":"string"},"deliveryProvider":{"$ref":"#/components/schemas/DeliveryProvider"},"status":{"type":"string","enum":["CREATED","CANCELLED"]}}},"DeliveryProvider":{"type":"string","enum":["VELOCE","ONFLEET"]},"OrderStatus":{"type":"string","enum":["IN_CHECKOUT","CREATED","CONFIRMED","DECLINED","SHIPPED","COMPLETED"]},"DeliveryTime":{"type":"object","properties":{"deliveryDate":{"type":"string","format":"date"},"deliveryTimeFrom":{"type":"string","format":"time"},"deliveryTimeTo":{"type":"string","format":"time"},"deliveryCosts":{"type":"number"},"pickupSettings":{"type":"string"}}},"PickupAddress":{"type":"object","properties":{"id":{"type":"string"},"street":{"type":"string"},"streetNumber":{"type":"string"},"city":{"type":"string"},"zipCode":{"type":"string"},"companyName":{"type":"string"},"country":{"type":"string"},"addressName":{"type":"string"},"description":{"type":"string"},"addressTag":{"type":"string"}}},"ShippingAddress":{"type":"object","properties":{"contactName":{"type":"string"},"companyName":{"type":"string"},"street":{"type":"string"},"streetNumber":{"type":"string"},"streetAppendix":{"type":"string"},"extraLine1":{"type":"string"},"extraLine2":{"type":"string"},"extraLine3":{"type":"string"},"extraLine4":{"type":"string"},"zipCode":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"state":{"type":"string"},"contactPhone":{"type":"string"},"mixins":{"type":"object","additionalProperties":true}}},"ErrorMessage":{"required":["message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"_embedded":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"}}}}}}}}},"responses":{"BadRequest_400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"NotFound_404":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/delivery-v2/{tenant}/order/{orderId}":{"get":{"summary":"Retrieving an order","description":"Get order by a given orderId and tenant.\n","parameters":[{"name":"tenant","in":"path","required":true,"schema":{"type":"string"}},{"name":"orderId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Resource successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderDTO"}}}},"400":{"$ref":"#/components/responses/BadRequest_400"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"404":{"$ref":"#/components/responses/NotFound_404"}},"operationId":"GET-delivery-retrieve-order","tags":["Delivery Orders"]}}}}
```
