retailCRM Documentation

Information on delivery in API

General structure of delivery data

Integration delivery data is available for v3, v4, v5 api versions.

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

Message structure for methods /api/v*/orders/get, /api/v*/orders, /api/v*/orders/history:

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

Messages structure for methods /api/v*/orders/create, /api/v*/orders/edit, /api/v*/orders/upload is different depending on delivery type - is it integrated or not. For integrated delivery service additionally needs to specify field data, which contains additional data for integrated delivery service. You may read the detailed description of this field for each kind of integrated delivery service in section Data of integrated delivery services.

Example of request on creation/editing of order with non-integrated delivery service:

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

Example of request on creation/editing of order with integrated delivery service: Russian Post:

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

Data structure of delivery address

Delivery address order[delivery][address] can be specified either as a string in the field order[delivery][address][text], or in detailed view filling all fields except order[delivery][address][text]. Example of request with detailed filling of all delivery address fields:

{
    "order": {
         //...
        "delivery": {
            //...
            "address": {
                "index":"398916",             // Postal code
                "region":"Moscow",            // Region
                "regionId":55,                // Region 
                "city":"Moscow",              // City
                "cityId":4995,                // City id in geohelper
                "street":"Mytnaya",           // Street
                "streetId":1777167,           // Street id in geohelper
                "building":"25",              // Building
                "flat":"13",                  // Flat or office
                "intercomCode":"2554",        // Intercom code
                "floor":5,                    // Floor
                "block":3,                    // Entrance
                "house":"1",                  // Housing
                "metro":"Shabolovskaya",        // Underground station
                "notes":"2nd entrance"          // Additional info
                "deliveryTime":"с 10:00 до 12:00" // Delivery time
            }
        }
    }
}

Example of request with delivery address transfer as string:

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

Delivery data

Limitations for editing orders with integrational deliveries

When editing through order API with registered integrational delivery there are limitations. Dependng on delivery type you cannot change data in following fields:

SDEK

SPSR

DPD

New Post

Checkout


PrintEditHistory
Page last modified on August 11, 2017, at 01:14 PM