Creating an order
Introduction
Before creating an order, the system needs to:
- Make sure the customer's address is within the delivery zone.
- Select the desired establishment that delivers to the specified address if several restaurants deliver.
Before requesting to create an order, use the request to search for a suitable restaurant by coordinates.
Request:
GET https://delivery.ucs.ru/orders/api/v1/restaurants/geo/first
with parameters:
- lat — the latitude at which the client's address is located
- lon — the longitude at which the client's address is located.
To find out the coordinates of a specific address, use the address search query.
Request:
GET https://delivery.ucs.ru/orders/api/v1/addresses/suggestions
where the search parameter is responsible for the address.
Example request:
https://delivery.ucs.ru/orders/api/v1/addresses/suggestions?search=%D0%93%D0%BE%D0%B3%D0%BE%D0%BB%D1%8F+13
Example answer:
"result": [
{
"address": "Novosibirsk Gogol street, 13",
"fullAddress": "Novosibirsk Gogol street, 13",
"country": "Novosibirsk",
"region": "",
"city": "Novosibirsk",
"street": "Gogol street",
"house": " 13",
"building": "",
"postalCode": "",
"geoLat": 55.04372025,
"geoLon": 82.92234039,
"geoAccuracy": "None"
},
{
"address": "Almaty Gogol street, 13",
"fullAddress": "Almaty Gogol street, 13",
"country": "Almaty",
"region": "",
"city": "Almaty",
"street": "Gogol street",
"house": " 13",
"building": "",
"postalCode": "",
"geoLat": 43.2612915,
"geoLon": 76.96231842,
"geoAccuracy": "None"
},
]
}
Example request:
GET https://delivery.ucs.ru/orders/api/v1/restaurants/geo/first?lat=55.706882&lon=37.592094
Example answer:
{
"result":{
"restaurantId":"76439fb3-c0c4-42ca-a269-64f031a6a33b",
"restaurantName":"Restaurant 0263",
"polygonId":"b87fc7ba-cbf0-47da-b2ff-a92de8c8a827",
"polygonName":"Moscow 263",
"legalAddress":"Moscow, Sorge str., 28",
"objectId":199990263,
"corporationId":"ce939b6c-611d-47a1-90a6-5054c8492733",
"minOrderAmountDelivery":0.0,
"minOrderAmountFreeDelivery":0.0,
"amountDelivery":null,
"deliveryTime":0,
"priority":0,
"typeOfTransportIds":[
],
"isActive":true
}
}
Use the received restaurantId in the body of the request to create an order.
Request
POST https://delivery.ucs.ru/orders/api/v1/orders
Content-Type: application/json
Example request
{
"comment": "cook with love ",
"restaurantId": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"persons": "1",
"dishList": [
{
"id": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"name": "Caesar salad",
"price": "400",
"measure": {
"value": "0.300",
"unit": "kg"
},
"quantity": "1",
"ingredients": [
{
"id": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"name": "tomatoes",
"price": "120",
"measure": {
"value": "0.100",
"unit": "kg"
},
"quantity": "2"
}
]
}
],
"expeditionType": "delivery",
"expectedAt":"2021-06-16T14:03:42.504+03:00",
"paymentTypeId": "card",
"changeFrom": "5000",
"guest": {
"email": "eewd@dgf.ru",
"phone": "79211234567",
"firstName": "Oleg"
},
"address": {
"postcode": "109443",
"cityId": "73439fb3-c0c4-42ca-a269-64f031a6a33b",
"street": "Yunykh Lenintsev",
"comment": " the house is to the right of the school",
"lat": "55.700897",
"lon": "37.773808",
"cityName": "Moscow",
"entrance": "1",
"houseNumber": "85",
"apartmentNumber": "6",
"intercom": "6В",
"subway": "Kuzminki",
"fullAddress": "109443, Moscow, Yunykh Lenintsev st., 85 k 2, apt 6"
}
}
When passing the expectedAt parameter, be sure to specify the time zone
Answer
Status code: 201
Parameter | Description | Example | |
---|---|---|---|
orderId | string | order number |
CODE
|
Parameters
Depending on the delivery method: delivery (courier delivery) or pickup (self-pickup), the mandatory fields vary.
To ensure that the system transfers orders immediately, specify the soonest parameter in the request
"soonest": true
and do not specify the expectedAt parameter in this case. In this case, it is not mandatory. The soonest orders are transferred to the checkout with minimal delay.
Parameter | Description | Mandatory for delivery | Mandatory for pickup | Limitations | |
---|---|---|---|---|---|
comment | string | comment to the order | |||
restaurantId | string | restaurant id (GUID format) from Delivery | yes | yes | GUID format |
persons | int | number of persons | > 0, max. 2147483647 | ||
dishList | array | order contents | yes | yes | |
-id | string | dish id (GUID format) from the Delivery menu view, which is used to synchronize with the cash register | yes, if externalId is not filled | yes, if externalId is not filled | GUID format |
-name | string | name of the dish | - | ||
-price | double the separator will always be a period - "." | price of the dish | 131072 digits before the decimal separator and 16383 digits after the separator | ||
-measure | measure | ||||
--value | double | serving size | |||
--unit | string | unit of measurement: kg, liter, pcs. The meaning is not a dictionary one | |||
-quantity | double the separator will always be a period - "." | number of dishes | yes | yes | |
-ingredients | array | ingredients | |||
--id | string | ingredient id (GUID format) from the Delivery menu view, which is used to sync with the cash register | GUID format | ||
--name | string | name of ingredient | - | ||
--price | double the separator will always be a period - "." | ingredient price | - | ||
--quantity | double the separator will always be a period - "." | quantity of ingredient | yes | yes | > 0 |
--ingredients | array | modifiers | |||
---id | string | modifier id (GUID format) from the Delivery menu view, which is used for synchronization with the cash register | GUID format | ||
---name | string | modifier name | - | ||
---price | double the separator will always be a period - "." | modifier price | - | ||
---quantity | double the separator will always be a period - "." | modifier amount | yes | yes | > 0 |
expeditionType | string | id of the method of receiving the order:
| yes | yes | pickup or delivery only |
soonest | boolean | order transfer time "Soonest" | only true or false | ||
expectedAt | DateTime | time by which the order is expected | yes\no if soonest parameter is passed | yes | |
paymentTypeId | string | payment method id:
| yes | yes | cash, card or online only |
changeFrom | double the separator will always be a period - "." | change from what amount | - | ||
guest | guest | yes | yes | ||
string | guest email | art. email rules | |||
-phone | string | phone number | yes | yes | phone number |
-firstName | string | name | - | ||
-lastName | string | surname | - | ||
address | delivery address | ||||
-postcode | string | zip code | - | ||
-street | string | street | yes | - | |
-comment | string | comment to address | - | ||
-lat | double the separator will always be a period - "." | latitude | >= -90 and <=90 | ||
-lon | double the separator will always be a period - "." | longitude | >= -180 and <=180 | ||
-cityId | string | city id | - | ||
-cityName | string | name of the city | yes | - | |
-floor | int | floor | max. 2147483647 | ||
-houseNumber | string | building number | yes | no more than 200 characters | |
-apartmentNumber | string | apartment number | no more than 20 characters | ||
-intercom | string | intercom | no more than 20 characters | ||
-entrance | string | entrance | no more than 30 characters | ||
-subway | string | subway | no more than 100 characters | ||
-fullAddress | string | full address | yes | no more than 150 characters |
To fill an order with dishes that have the Separate line for each serving option selected in the Add to order property, the dishes should be sent separately as part of the dishList. For example, not "quantity":"3", but 3 times "quantity":"1".
"dishList":[ { "externalId":"1000737", "price":"260", "quantity":"3", "ingredients":[ { "externalId":"1003205", "quantity":"1" }, { "externalId":"1000215", "quantity":"1" }, { "externalId":"1003210", "quantity":"1" }, { "externalId":"1003305", "quantity":"1" }, { "externalId":"1000218", "quantity":"1" }, { "externalId":"1002372", "quantity":"1" }, { "externalId":"1000221", "quantity":"1" }, { "externalId":"1000224", "quantity":"1" }, { "externalId":"1002376", "quantity":"1" }, { "externalId":"1002834", "quantity":"1" } ] } ]
"dishList":[ { "externalId":"1000737", "price":"260", "quantity":"1", "ingredients":[ { "externalId":"1003205", "quantity":"1" }, { "externalId":"1000215", "quantity":"1" }, { "externalId":"1003210", "quantity":"1" }, { "externalId":"1003305", "quantity":"1" }, { "externalId":"1000218", "quantity":"1" }, { "externalId":"1002372", "quantity":"1" }, { "externalId":"1000221", "quantity":"1" }, { "externalId":"1000224", "quantity":"1" }, { "externalId":"1002376", "quantity":"1" }, { "externalId":"1002834", "quantity":"1" } ] }, { "externalId":"1000737", "price":"260", "quantity":"1", "ingredients":[ { "externalId":"1003205", "quantity":"1" }, { "externalId":"1000215", "quantity":"1" }, { "externalId":"1003210", "quantity":"1" }, { "externalId":"1003305", "quantity":"1" }, { "externalId":"1000218", "quantity":"1" }, { "externalId":"1002372", "quantity":"1" }, { "externalId":"1000221", "quantity":"1" }, { "externalId":"1000224", "quantity":"1" }, { "externalId":"1002376", "quantity":"1" }, { "externalId":"1002834", "quantity":"1" } ] }, { "externalId":"1000737", "price":"260", "quantity":"1", "ingredients":[ { "externalId":"1003205", "quantity":"1" }, { "externalId":"1000215", "quantity":"1" }, { "externalId":"1003210", "quantity":"1" }, { "externalId":"1003305", "quantity":"1" }, { "externalId":"1000218", "quantity":"1" }, { "externalId":"1002372", "quantity":"1" }, { "externalId":"1000221", "quantity":"1" }, { "externalId":"1000224", "quantity":"1" }, { "externalId":"1002376", "quantity":"1" }, { "externalId":"1002834", "quantity":"1" } ] } ],
Creating an order with a non-existent address
It will be difficult for restaurant couriers to deliver the order. Also, such orders will not be able to be processed by a third-party delivery service, for example, Yandex.Delivery.
In fast-growing settlements, addresses do not have time to get into the database system that r_k Delivery accesses. For such situations, and also if it is necessary to allow delivery to places without addresses, it is possible to create orders without specifying the house and coordinates.
Request:
POST https://delivery.ucs.ru/orders/api/v1/orders
Content-Type: application/json
An example of such a request:
{
"comment": "cook with love ",
"restaurantId": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"persons": "1",
"dishList": [
{
"id": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"name": "Caesar salad",
"price": "400",
"measure": {
"value": "0.300",
"unit": "kg"
},
"quantity": "1",
"ingredients": [
{
"id": "76439fb3-c0c4-42ca-a269-64f031a6a33b",
"name": "tomatoes",
"price": "120",
"measure": {
"value": "0.100",
"unit": "kg"
},
"quantity": "2"
}
]
}
],
"expeditionType": "delivery",
"expectedAt":"2021-06-16T14:03:42.504+03:00",
"paymentTypeId": "card",
"changeFrom": "5000",
"guest": {
"email": "eewd@dgf.ru",
"phone": "79211234567",
"firstName": "Oleg"
},
"address":{
"street":"Kremlyovskiye Kursanty Alley",
"comment":"The intercom is not working, this is a country house settlement. Call the mobile phone.",
"lat":0,
"lon":0,
"cityName":"Moscow",
"apartmentNumber":"1",
"fullAddress":"Kremlyovskiye Kursanty Alley",
"floor":1
},
}