Create courier invitation
Creates a new request to call a courier to pick up a shipment
Function CreateCourierInvitation(Val Token, Val InvitationDescription, Val TestAPI = False) Export
Parameter | CLI option | Type | Required | Description |
---|---|---|---|---|
Token | --token | String | ✔ | Auth token |
InvitationDescription | --intake | Structure of KeyAndValue | ✔ | Invitations description. See GetCourierInvitationsDescription |
TestAPI | --testapi | Boolean | ✖ | Flag to use test API for requests |
Returns: Map Of KeyAndValue - serialized JSON response from CDEK
tip
Method at API documentation: Registration of refusal
1C:Enterprise/OneScript code example
Token = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJsb2NhdGlvbjphbGwiLCJvcmRlcjphbGwiLCJwYXltZW50OmFsbCJdLCJleHAiOjE3MzAyNzQyOTksImF1dGhvcml0aWVzIjpbInNoYXJkLWlkOnJ1LTAxIiwiY2xpZW50LWNpdHk60J3QvtCy0L7RgdC40LHQuNGA0YHQuiwg0J3QvtCy0L7RgdC40LHQuNGA0YHQutCw0Y8g0L7QsdC70LDRgdGC0YwiLCJhY2NvdW50LWxhbmc6cnVzIiwiY29udHJhY3Q60JjQnC3QoNCkLdCT0JvQky0yMiIsImFjY291bnQtdXVpZDplOTI1YmQwZi0wNWE2LTRjNTYtYjczNy00Yjk5YzE0ZjY2OWEiLCJhcGktdmVyc2lvbjoxLjEiLCJjbGllbnQtaWQtZWM1OmVkNzVlY2Y0LTMwZWQtNDE1My1hZmU5LWViODBiYjUxMmYyMiIsImNvbnRyYWN0LWlkOmRlNDJjYjcxLTZjOGMtNGNmNS04MjIyLWNmYjY2MDQ0ZThkZiIsImNsaWVudC1pZC1lYzQ6MTQzNDgyMzEiLCJjb250cmFnZW50L...";
CurrentDate = OPI_Tools.GetCurrentDate();
InvitationDescription = New Structure;
InvitationDescription.Insert("intake_date" , Format(CurrentDate + 60 * 60 * 24, "DF=yyyy-MM-dd"));
InvitationDescription.Insert("intake_time_from", "10:00");
InvitationDescription.Insert("intake_time_to" , "17:00");
InvitationDescription.Insert("name" , "Consolidated cargo");
InvitationDescription.Insert("weight" , 1000);
InvitationDescription.Insert("length" , 10);
InvitationDescription.Insert("width" , 10);
InvitationDescription.Insert("height" , 10);
InvitationDescription.Insert("comment" , "Comment to courier");
InvitationDescription.Insert("need_call" , False);
Sender = New Structure;
Sender.Insert("company", "Company");
Sender.Insert("name" , "Ivaniv Ivan");
Phones = New Array;
Phone = New Structure("number", "+79589441654");
Phones.Add(Phone);
Sender.Insert("phones", Phones);
InvitationDescription.Insert("sender", Sender);
ShippingPoint = New Structure;
ShippingPoint.Insert("code" , "44");
ShippingPoint.Insert("fias_guid" , "0c5b2444-70a0-4932-980c-b4dc0d3f02b5");
ShippingPoint.Insert("postal_code" , "109004");
ShippingPoint.Insert("longitude" , 37.6204);
ShippingPoint.Insert("latitude" , 55.754);
ShippingPoint.Insert("country_code", "RU");
ShippingPoint.Insert("region" , "Moscow");
ShippingPoint.Insert("sub_region" , "Moscow");
ShippingPoint.Insert("city" , "Moscow");
ShippingPoint.Insert("kladr_code" , "7700000000000");
ShippingPoint.Insert("address" , "st. Bluchera, 32");
InvitationDescription.Insert("from_location", ShippingPoint);
Result = OPI_CDEK.CreateCourierInvitation(Token, InvitationDescription, True);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint cdek CreateCourierInvitation \
--token "***" \
--intake "{'intake_date':'2024-11-01','intake_time_from':'10:00','intake_time_to':'17:00','name':'Consolidated cargo','weight':1000,'length':10,'width':10,'height':10,'comment':'Comment to courier','need_call':false,'sender':{'company':'Company','name':'Ivaniv Ivan','phones':[{'number':'+79589441654'}]},'from_location':{'code':'44','fias_guid':'0c5b2444-70a0-4932-980c-b4dc0d3f02b5','postal_code':'109004','longitude':37.6204,'latitude':55.754,'country_code':'RU','region':'Moscow','sub_region':'Moscow','city':'Moscow','kladr_code':'7700000000000','address':'st. Bluchera, 32'}}" \
--testapi "***"
:: JSON data can also be passed as a path to a .json file
oint cdek CreateCourierInvitation ^
--token "***" ^
--intake "{'intake_date':'2024-11-01','intake_time_from':'10:00','intake_time_to':'17:00','name':'Consolidated cargo','weight':1000,'length':10,'width':10,'height':10,'comment':'Comment to courier','need_call':false,'sender':{'company':'Company','name':'Ivaniv Ivan','phones':[{'number':'+79589441654'}]},'from_location':{'code':'44','fias_guid':'0c5b2444-70a0-4932-980c-b4dc0d3f02b5','postal_code':'109004','longitude':37.6204,'latitude':55.754,'country_code':'RU','region':'Moscow','sub_region':'Moscow','city':'Moscow','kladr_code':'7700000000000','address':'st. Bluchera, 32'}}" ^
--testapi "***"
Result
{
"entity": {
"uuid": "72753031-e8e5-4454-b51a-643dbacc9e2d"
},
"requests": [
{
"request_uuid": "c034b699-b211-4c90-bfee-f8203cadb95b",
"type": "CREATE",
"date_time": "2024-10-21T21:28:16+03:00",
"state": "ACCEPTED"
}
],
"related_entities": []
}