Tools - Reusing declaration data
If you already created a declaration in Shipment, you can get its data from your browser and use it to build a JSON message for the API.
This works for all documents and flows.
The request name, the screen names and the field adjustments in this article are from DMS Export.
For other message types, compare the payload with the field list of that message.
Get the data from your browser
These steps save the declaration.
Preferably use the Test environment, or a declaration that you are allowed to save.
This was checked with a declaration with status In voorbereiding.
You can't get the payload from a declaration that has already been submitted.
In that case, create it again or make a copy, and use the steps below on the new one.
Chamber of Commerce documents can't be copied.
All other documents can.
- Open the declaration in Shipment (wizard DMS uitvoeraangifte bewerken).
- Open the developer tools of your browser (F12) and select the Network tab.
- In the wizard, go to a step, for example Aangifte, and click the button to the next step.
In the step Aangifte this button is called Afzender selecteren.
Shipment saves the declaration and the request Update appears (POST, path ends withdmsExportDeclaration/Update). - Select the request and open the Payload tab.
It containsid,recalculateTotalGrossWeightanddeclarationData. - Copy only the
declarationDataobject.
Keep it safe
Updateis an internal request of the Shipment website, not part of the API.
Don't call it from your integration.- Don't copy headers or cookies and don't share a HAR file: they can contain login details.
- The payload itself can contain customer data.
Anonymise it before you share it.
Adjust the data
You can't send the payload to the API unchanged.
The specification doesn't allow unknown fields in declarationData (additionalProperties: false).
This has not been tested against the API.
Field names in the table are relative to declarationData.
| Field in the payload | What to do |
declarationName (with declarationSymbol and declarationType) |
declarationName is not in the specification: remove it.The specification has declarationData.declarationType (string, 1 character, code list CL042, default A).If needed, put the value of declarationName.declarationType in declarationData.declarationType.declarationSymbol is dropped. |
departureTransportMeans.cargoTransportMeans |
Not in the specification: remove it. |
goodsLocation.identificationType |
Not in the specification: remove it. |
transportEquipment[] (top level) |
Keep sequenceNumber, number and seals[].number.transportEquipment[].seals[].sequenceNumber is not in the specification: remove it. |
isContainerShipment |
The container information is only used when this is true. |
goodsItems[].transportEquipment |
The payload has objects (sequenceNumber, number, seals).The specification expects a list of integers that refer to the sequenceNumber of the top-level transportEquipment[].Replace the objects, for example with [1]. |
sequenceNumber in goodsItems[].additionalInformation, additionalDocuments, previousDocuments, additionalReferences and packaging |
Not in the specification: remove it. Keep goodsItems[].sequenceNumber. |
goodsItems[].isCreatedFromEmcs and goodsItems[].transportDocuments |
Not in the specification: remove them. |
goodsItems[].previousDocuments (list) |
Still works, but is deprecated. Use goodsItems[].previousDocument: one object per goods item. |
| Empty values | The payload contains fields with null, empty text or empty lists.For example, governmentProcedure.specialCode was a list with one empty text.Leave them out. |
According to the specification, destinationCountry and governmentProcedure are required in declarationData.
Build the message
dossierNumber: required, 1 to 30 characters.
Use underscores, not hyphens.dmsExportDeclarations[]: the list of declarations, each with the fields below.applicationReferenceId: required.
Always use a new value and never reuse one.
A duplicate can return HTTP 409.doSubmitWhenValid: the default isfalse, which is also recommended while testing.doNotSaveWhenInvalid:trueis recommended.declarationData: the adjusted object.consignor: required and not part ofdeclarationData.
For DMS Export,internalCodeis required.consignee: also not part ofdeclarationData.
You can useinternalCode, for example.
Send the message to /erpservices/ImportDossier.
The example below shows only the envelope.
You can't send it like this: declarationData is empty.
{
"dossierNumber": "ORDER_10001",
"dmsExportDeclarations": [
{
"applicationReferenceId": "ORDER_10001_01",
"doSubmitWhenValid": false,
"doNotSaveWhenInvalid": true,
"declarationData": { },
"consignor": { "internalCode": "YOUR_INTERNAL_CODE" },
"consignee": { "internalCode": "CONSIGNEE_CODE" }
}
]
}
See the articles Payload rules and DMS Export.
Check before you reuse
- References, dates, document numbers, weights, amounts and goods items belong to the old shipment.
Check and update them. acceptanceDateis only for typeR.bookingReferenceNumberandterminalwere not in the payload that was checked (the fields were empty on screen).- Always check
isSavedanderrorsin the response.