In this article, we are using the SubmitShipment method on the API to create/book a shipment
https://helpcenter.nshift.com/hc/en-us/articles/4401176907676#post_shipments
But depending on the flow you are implementing one of the following methods might be a better option:
- https://helpcenter.nshift.com/hc/en-us/articles/4401176907676-API-Documentation#post_saveshipment
- https://helpcenter.nshift.com/hc/en-us/articles/4401176907676-API-Documentation#post_importUpload
- https://helpcenter.nshift.com/hc/en-us/articles/4401176907676-API-Documentation#post_orderAdvice
- https://helpcenter.nshift.com/hc/en-us/articles/4401176907676-API-Documentation#post_submitOrder
Before you continue please take a look at the following section of the API Documentation:
https://helpcenter.nshift.com/hc/en-us/articles/4401176907676#post_shipments_options
https://helpcenter.nshift.com/hc/en-us/articles/4401176907676#data_object
Environment URL
Examples on 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://helpcenter.nshift.com/hc/en-us/articles/4401176907676-API-Documentation#get_documents