In this article, we are using the SubmitShipment method on the API to create/book a shipment
https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_shipments
But depending on the flow, you are implementing one of the following methods might be a better option:
- https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_saveshipment
- https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_importUpload
- https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_orderAdvice
- https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_submitOrder
Before you continue, please take a look at the following section of the API Documentation:
https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988#post_shipments_options
https://nshiftship.zendesk.com/hc/en-us/articles/23093866504604-Shipment-Data-Object
Environment URL
Examples of how to book a shipment
The Data Object defines the shipment, and the Options Object provides configuration for the method.
Example 1. ( single package )
Example 2. ( multiple packages with the same weight )
Example 3. ( multiple packages with different weights )
Example 1. ( single package )
curl -s -X POST "{{URL}}/ShipServer/{{ACTOR_ID}}/Shipments"
-H "Authorization: {{TOKEN}}"
-H "Content-Type: application/json"
--data-raw "{
\"data\": {
\"ProdConceptID\": 1782,
\"OrderNo\": \"Test Shipment 1\",
\"Addresses\": [{
\"Kind\": 1,
\"Name1\": \"Test Receiver Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 7400,
\"City\": \"Herning\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
},{
\"Kind\": 2,
\"Name1\": \"Test Sender Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 6400,
\"City\": \"Sønderborg\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
}],
\"Lines\":[{
\"Number\": 1,
\"PkgWeight\": 10000,
\"Height\": 100,
\"Length\": 100,
\"Width\": 100,
\"GoodsTypeID\": 13,
\"References\": [{
\"Kind\": 23,
\"Value\": \"Test Shipment - Do not process !\"
}]
}]
},
\"options\": { \"Labels\": \"ZPLGK\" }
}"Example 2. ( multiple packages with the same weight )
curl -s -X POST "{{URL}}/ShipServer/{{ACTOR_ID}}/Shipments"
-H "Authorization: {{TOKEN}}"
-H "Content-Type: application/json"
--data-raw "{
\"data\": {
\"ProdConceptID\": 1782,
\"OrderNo\": \"Test Shipment 1\",
\"Addresses\": [{
\"Kind\": 1,
\"Name1\": \"Test Receiver Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 7400,
\"City\": \"Herning\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
},{
\"Kind\": 2,
\"Name1\": \"Test Sender Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 6400,
\"City\": \"Sønderborg\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
}],
\"Lines\":[{
\"Number\": 2,
\"PkgWeight\": 10000,
\"Height\": 100,
\"Length\": 100,
\"Width\": 100,
\"GoodsTypeID\": 13,
\"References\": [{
\"Kind\": 23,
\"Value\": \"Test Shipment - Do not process !\"
}]
}]
},
\"options\": { \"Labels\": \"ZPLGK\" }
}"Example 3. ( multiple packages with different weights )
curl -s -X POST "{{URL}}/ShipServer/{{ACTOR_ID}}/Shipments"
-H "Authorization: {{TOKEN}}"
-H "Content-Type: application/json"
--data-raw "{
\"data\": {
\"ProdConceptID\": 1782,
\"OrderNo\": \"Test Shipment 1\",
\"Addresses\": [{
\"Kind\": 1,
\"Name1\": \"Test Receiver Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 7400,
\"City\": \"Herning\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
},{
\"Kind\": 2,
\"Name1\": \"Test Sender Name1\",
\"Street1\": \"Test Road 1\",
\"PostCode\": 6400,
\"City\": \"Sønderborg\",
\"CountryCode\": \"DK\",
\"Phone\": \"12341234\",
\"Mobile\": \"12341234\",
\"Email\": \"noreply@nshift.com\",
\"Attention\": \"Test Attention\"
}],
\"Lines\":[{
\"Number\": 1,
\"PkgWeight\": 10000,
\"Height\": 100,
\"Length\": 100,
\"Width\": 100,
\"GoodsTypeID\": 13,
\"References\": [{
\"Kind\": 23,
\"Value\": \"Test Shipment - Do not process !\"
}]
},{
\"Number\": 1,
\"PkgWeight\": 15000,
\"Height\": 100,
\"Length\": 100,
\"Width\": 100,
\"GoodsTypeID\": 13,
\"References\": [{
\"Kind\": 23,
\"Value\": \"Test Shipment - Do not process !\"
}]
}]
},
\"options\": { \"Labels\": \"ZPLGK\" }
}"
Response
All examples will generate a response like the one below
{
"ShpCSID": 161323,
"ShpNo": "70730254433124072",
"OrderNo": "Test Shipment 1",
"ProdConceptID": 1782,
"Addresses": [...],
"Lines": [...],
"Labels": [{
"Content": "XlhBXkNXSSxFOlotRVB...",
"Type": 13,
"Copies": 1,
"PkgCSID": 162500,
"PkgNo": "00370730254433124088"
}, {
"Content": "XlhBXkNXSSxFOlotRVB...",
"Type": 13,
"Copies": 1,
"PkgCSID": 162501,
"PkgNo": "00370730254433124095"
}
],
"ShpDocuments": [{
"ShpCSID": 161323,
"DocumentID": 1217,
"DocumentCSID": 165178,
"Copies": 1,
"DocumentName": "Generic Sweden",
"PrintedDt": "2022-08-04T12:56:40",
"DocumentType": "Label"
}, {
"ShpCSID": 161323,
"DocumentID": 104,
"DocumentCSID": 165179,
"Copies": 1,
"DocumentName": "SE.Fraktsedel",
"PrintedDt": "2022-08-04T12:56:40",
"DocumentType": "FreightLetter"
}
]
}- Labels[0].Content - Labels are returned in the requested format, but encoded with base64
- ShpDocuments - Information about generated Labels and Documents
-
ShpDocuments[1].ShpCSID - use the get_documents method to get the documents
https://nshiftship.zendesk.com/hc/en-us/articles/23142488632988-API-Documentation#get_documents