In diesem Artikel verwenden wir die Methode SubmitShipment in der API, um eine Sendung zu erstellen/buchen
https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_shipments
Je nach Ablauf kann es besser sein, eine der folgenden Methoden zu implementieren:
- https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_saveshipment
- https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_importUpload
- https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_orderAdvice
- https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_submitOrder
Bevor Sie fortfahren, werfen Sie bitte einen Blick auf den folgenden Abschnitt der API-Dokumentation:
https://nshiftship.zendesk.com/hc/de/articles/23142488632988#post_shipments_options
https://nshiftship.zendesk.com/hc/de/articles/23093866504604-Shipment-Data-Object
Umgebungs-URL
Beispiele, wie man eine Sendung bucht
Das Datenobjekt definiert die Sendung, und das Optionsobjekt liefert die Konfiguration für die Methode.
Beispiel 1. (einzelnes Paket)
Beispiel 2. (mehrere Pakete mit gleichem Gewicht)
Beispiel 3. (mehrere Pakete mit unterschiedlichem Gewicht)
Beispiel 1. (einzelnes Paket)
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\" }
}"Beispiel 2. (mehrere Pakete mit gleichem Gewicht)
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\" }
}"Beispiel 3. (mehrere Pakete mit unterschiedlichem Gewicht)
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\" }
}"
Antwort
Alle Beispiele erzeugen eine Antwort wie die untenstehende
{
"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 werden im angeforderten Format zurückgegeben, jedoch base64-codiert
- ShpDocuments - Informationen über erzeugte Labels und Dokumente
-
ShpDocuments[1].ShpCSID - Verwenden Sie die Methode get_documents, um die Dokumente abzurufen
https://nshiftship.zendesk.com/hc/de/articles/23142488632988-API-Documentation#get_documents