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
CODE

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
CODE

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
CODE

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"
        },     
    ]
}
CODE

Example request:

GET https://delivery.ucs.ru/orders/api/v1/restaurants/geo/first?lat=55.706882&lon=37.592094
CODE

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
   }
}
CODE

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" 
  } 
}
CODE

When passing the expectedAt parameter, be sure to specify the time zone

Answer

Status code: 201

Parameter 
DescriptionExample
 orderId

stringorder number 
{
   "result": {
      "orderId": "765"
   }
}
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
CODE

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
DescriptionMandatory for deliveryMandatory for pickupLimitations
commentstringcomment to the order


restaurantIdstringrestaurant id (GUID format) from DeliveryyesyesGUID format
personsintnumber of persons

> 0, max. 2147483647
dishListarrayorder contentsyesyes

-id

stringdish id (GUID format) from the Delivery menu view, which is used to synchronize with the cash registeryes, if externalId is not filledyes, if externalId is not filledGUID format
-namestringname 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


--valuedoubleserving size


--unitstringunit of measurement: kg, liter, pcs. The meaning is not a dictionary one 


-quantity

double

the separator will always be a period - "." 

number of dishesyesyes
-ingredientsarrayingredients 


--idstringingredient id (GUID format) from the Delivery menu view, which is used to sync with the cash register

GUID format
--namestringname of ingredient

-
--price

double

the separator will always be a period - "." 

ingredient price

-
--quantity

double

the separator will always be a period - "." 

quantity of ingredientyesyes> 0
--ingredientsarraymodifiers 


---idstringmodifier id (GUID format) from the Delivery menu view, which is used for synchronization with the cash register

GUID format
---namestringmodifier name

-
---price

double

the separator will always be a period - "." 

modifier price

-
---quantity

double

the separator will always be a period - "." 

modifier amountyesyes> 0
expeditionTypestring

id of the method of receiving the order:

  • "delivery" - delivery 
  • "pickup" - self pickup 
yesyespickup or delivery only 
soonestbooleanorder transfer time "Soonest"

only true or false
expectedAtDateTimetime by which the order is expectedyes\no if soonest parameter is passedyes
paymentTypeIdstring

payment method id:

  • "cash" - payment in cash
  • "card" - payment by card
  • "online" - online payment.
yesyescash, card or online only
changeFrom

double

the separator will always be a period - "." 

change from what amount

-
guest
guestyesyes
-emailstringguest email

art. email rules
-phonestringphone numberyesyesphone number
-firstNamestringname

-
-lastNamestringsurname 

-
address
delivery address


-postcodestringzip code

-
-streetstringstreetyes
-
-commentstringcomment 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
-cityIdstringcity ​​id

-
-cityNamestringname of the cityyes
-
-floorintfloor

max. 2147483647
-houseNumberstringbuilding numberyes
no more than 200 characters
-apartmentNumberstringapartment number 

no more than 20 characters
-intercom stringintercom

no more than 20 characters
-entrancestringentrance

no more than 30 characters
-subwaystringsubway

no more than 100 characters
-fullAddressstringfull addressyes
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 is not recommended to use the method of creating an order with a non-existent address unless absolutely necessary.
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
   },
}
CODE