Delivery data in API
Copy the link to the article
Copied

General structure of delivery data

Delivery data of the integrated delivery is available for API versions v3, v4, v5.

In the /api/v*/orders and /api/v*/orders/history methods, the orders[][delivery] field is responsible for the delivery data, in other methods /api/v*/orders* - the order[delivery] field.

Structure of the message for methods /api/v*/orders/get, /api/v*/orders, /api/v*/orders/history:

"order": {
 // ...
 "delivery": {
 "code": "delivery-type-code", // Symbolic code of the delivery type
 "integrationCode": "sdek", // Code of the integrated delivery connected with the delivery type
 "data": {// Additional data for the integrated delivery
 // Data differs depending 
 // on the specified integrated delivery
 },
 "service": {// Delivery service
 "name": "Delivery Service 1",
 "code": "delivery-service-1"
 },
 "cost": 500, // Delivery cost
 "date": "2014-10-26", // Delivery date
 "address": {// Delivery address
 // ...
 }
 }
 }
} 

The message structure for the /api/v*/orders/create, /api/v*/orders/edit, /api/v*/orders/upload methods differs depending on the type of delivery - whether it is the integrated one or not. For integrated delivery, the data field is additionally specified, which contains additional data for integrated delivery. For more information on the description of this field for each type of integrated delivery, see the section "Data of integrated deliveries".

An example of a request to create/edit an order with non-integrated delivery:

"order": {
 // ...
 "delivery": {
 "code": "delivery-type-code",
 "service": {
 "name": "Delivery Service 1",
 "code": "delivery-service-1"
 },
 "cost": 500,
 "date": "2014-10-26",
 "address": {
 // ...
 }
 }
 }
} 

An example of a request to create/edit an order with integrated delivery Russian Post:

"order": {
 // ...
 "delivery": {
 "code": "russianpost-delivery",
 "data": {
 "trackNumber": "EA349651005RU"
 },
 "cost": 500,
 "date": "2014-10-26",
 "address": {
 // ...
 }
 }
 }
} 

Data structure of the delivery address

The delivery address order[delivery][address] can be specified either in string form in the order[delivery][address][text] field, or in detailed form, filling in all fields except order[delivery][address][text]. An example of a request with detailed filling in all fields of the delivery address:

"order": {
 // ...
 "delivery": {
 // ...
 "address": {
 "index": "398916", // Postal code
 "region": "Moscow", // Region
 "regionId": 55, // Region id in geohelper
 "city": "Moscow", // City
 "cityId": 4995, // ID of the city in geohelper
 "cityType": "g.", // Type of settlement
 "street": "Mytnaya", // Street
 "streetId": 1777167, // Street id in geohelper
 "streetType": "street", // Street type
 "building": "25", // House number
 "flat": "13", // Flat or office number
 "floor": 5, // Floor
 "block": 3, // Entrance
 "house": "1", // Building
 "housing": "1", // Building
 "metro": "Shabolovskaya", // Metro
 "notes": "2nd checkpoint" // Additional notes
 "deliveryTime": "from 10:00 to 12:00" // Delivery time
 }
 }
 }
} 

An example of a request with the transfer of the delivery address in string form:

"order": {
 // ...
 "delivery": {
 // ...
 "address": {
 "index": "614030",
 "city": "Perm",
 "text": "Yanaulskaya, 26, apt. 18"
 }
 }
 }
} 

Data of integrated deliveries

You can see methods of interaction with integrated deliveries in the reference book of API methods. You need to find the order[delivery][data] field and select the delivery service you need in the selection.

Restrictions when editing orders with integrated deliveries

When editing an order via API with a ''registered" integrated delivery, restrictions apply. Depending on the type of delivery, you cannot change the data in the following fields:

SDEK

order[weight]

order[length]

order[width]

order[height]

order[phone]

order[deliveryCost]

order[paymentType]

order[shipmentStore]

order[delivery][address]

DPD

order[weight]

order[manager]

order[phone]

order[firstName]

order[lastName]

order[deliveryCost]

order[paymentType]

order[shipmentStore]

order[delivery][address]

New Post

order[weight]

order[customer]

order[phone]

order[deliveryCost]

order[paymentType]

order[shipmentStore]

order[delivery][address]

Checkout

order[weight]

order[firstName]

order[lastName]

order[phone]

order[deliveryCost]

order[paymentType]

order[shipmentStore]

order[delivery][address]

Thank you for your feedback.
Was this article helpful?
No
  • Рекомендации не помогли
  • Нет ответа на мой вопрос
  • Текст трудно понять
  • Не нравится описанный функционал
Yes
Previous article
Examples of error messages from API
When accessing API, errors may be made. These errors are reported by the system. In this article, we will analyse the main types of errors.
Next article
Procedure for integrating delivery service via API
Procedure for integrating delivery service via API