DeliSky API Documentation

Create and send an order with custom items

Let's assume that we need catering for a flight from Zurich. We don't have any preference regarding the caterer, so we let DeliSky choose a caterer for us. Also, we will not select items from the caterer's menu. Instead we will just add our own custom menu items.

Preparing the categories

Since every order item must be assigned to a category, we must first fetch the categories. We achieve this by making a GET request to the /Categories endpoint.

Request

GET /Categories

This will return all categories (response shortened for readabilitym try it here to get the real output):

Response

200 OK "categories": [   {     "id": 48,     "parentId": 36,     "level": 2,     "name": "ColdMeals_Salads",     "displayName": "Salads"   },   {     "id": 90,     "parentId": 87,     "level": 2,     "name": "BreakfastAndBakery_Bread",     "displayName": "Bread"   },   … ]

Note: The categories are structured in a tree format, so each category has a parentId value which indicates the parent category. Categories with a level property of 1 are the main categories, such with a level of 2 are subcategories. You should assign your order items only to subcategories.

Creating the order

Now, that everything is in place, we can create the order. This is done by sending a POST request to the /Orders endpoint:

Request

POST /Orders {   "airportICAO": "lszh",   "deliveryDateTime": "2022-01-18T13:30",   "aircraftRegistration": "ABC-123",   "flightType": "Domestic flight",   "items": [     {       "name": "Fresh garden salad",       "quantity": 4,       "categoryId": 48     },     {       "name": "Mixed corn bread roll",       "quantity": 6,       "categoryId": 90       }   ],   "contactName": "Jane Doe",   "phone": "012 345 67 89",   "email": "jane.doe@example.com" }

Note: Read more about creating an order.

The API returns a 201 Created response and the following body (shortened for readability):

Response

201 Created {   "success": true,   "data": {     "order": {       "id": 12345,       "orderType": "FromMenu",       "operatorId": 6,       "operatorName": "TEST CLIENT",       "airportName": "Zurich",       "catererId": 3,       "catererName": "Fantastic Catering",       "deliveryDateTime": "2022-01-18T13:30:00",       "handlingAgentId": null,       "handlingAgentName": null,       "paymentOptionId": null,       "paymentOptionName": null,       "contactName": "Jane Doe",       "email": "jane.doe@example.com",       "phone": "012 345 67 89",       "items": [         {           "id": 109033,           "mainCategoryId": 36,           "categoryId": 48,           "itemType": "c",           "itemId": 0,           "name": "Fresh garden salad",           "description": null,           "price": null,           "quantity": 4,           "comments": null         },         {           "id": 109034,           "mainCategoryId": 87,           "categoryId": 90,           "itemType": "c",           "itemId": 0,           "name": "Mixed corn bread roll",           "description": null,           "price": null,           "quantity": 6,           "comments": null         }       ],       "aircraftRegistration": "ABC-123",     }   } }

Setting handling agent and payment option

As you can see, the DeliSky system chose "Fantastic Catering" as your caterer - fantastic! You may notice, that handlingAgentId/handlingAgentName and paymentOptionId/paymentOptionName, which are required, are not set yet. Since these depend on the selected caterer, we have to call the /Caterers/{catererId}/HandlingAgents and /Caterers/{catererId}/paymentOptions endpoints, to retrieve the available options. We can get the caterer's id from the created order, in this case 6.

Request

POST /Caterers/6/HandlingAgents

200 OK

{   "success": true,   "message": "",   "data": {     "handlingAgents": [       { "id": 1, "name": "Excellent Handling" },       { "id": 2, "name": "5 Stars Handling" },       { "id": 3, "name": "Handling, Handling and Handling" },     ]   }, }

Request

POST /Caterers/6/PaymentOptions

200 OK

{   "success": true,   "message": "",   "data": {     "handlingAgents": [       { "id": 1, "name": "by credit card - at the delivery" },       { "id": 2, "name": "by credit card - please provide credit card details to caterer" },       { "id": 3, "name": "by invoice (payable within 10 days)" },     ]   }, }

We now can update the order with a PUT request to the /Orders/{orderId} endpoint. We take the orderId from the POST /Orders response, 12345.

PUT /Orders/12345 {   "handlingAgentId": 2,   "paymentOptionId": 3 }

The API responds with a 200 OK and now the order is ready to be sent. We can verify it by calling the GET /Orders/{orderId}/Validate endpoint.

Sending the order

Now that the order is complete, we can send it to the caterer. This is done by sending a POST request to the /Orders/{orderId}/Send endpoint. If everything runs smoothly and no validation errors occur, the API responds with a 200 OK status and returns the order.

200 OK

// note: the whole order is returned // this is shortened for readability and only // the most important properties are shown {   "success": true,   "order": {     "id": 12345,     "orderNumber": "09876",     "orderStatus": "sent",     "items": [       ...     ]   } }

That's it. The caterer will confirm the order and then process it.