TradeLens offers bulk document uploads and downloads using our open APIs. To use this functionality for document downloads follow the below steps.
In this article
Authentication and Token Generation
For API usage, authentication and token generation are required to be in place for systems integrating with the TradeLens platform. For example, a system user (program code) that calls the APIs.
Here is a link to the document site for TradeLens that explains the token generation: https://docs.tradelens.com/how_to/token_generation/
Setting up the Call
Call the POST/api/v1/bulk/documents/downloadRequest endpoint under Document Sharing Bulk Operations API to initiate the download of documents. Executing this endpoint returns the bulkTransactionId
Example request for multiple objects
[
{
"identifiers": { // Identifier 1
"consignment": {
"carrierBookingNumber": "TestSales567" // Carrier booking number
}
}
},
"identifiers": { // Identifier 2
"consignment": {
"carrierBookingNumber": "TestSales667", // Carrier booking number
"billOfLadingNumber": "TestSales667" // Bill of lading number
}
}
},
{
"identifiers": { // Identifier 3
"shipment": {
"references": [
{
"reference": "S110CBN41", //Shipment reference
"type": "bookingReferenceNumber"
}
]
}
},
"linkedDocs": true // allows you to download the documents for linked tradeobjects without specifying identifiers for all the tradeobjects
}
]
Calling the Get
To know the status of the download, call the GET/api/v1/bulkTransactions/{bulkTransactionId} endpoint using the bulkTransactionId you received as a response from Step 2. This also provides you with a bulkDownloadRequestId, which is used as the input parameter for the next call.
Downloading the zipped file of documents
Call the GET/api/v1/bulk/documents/download/{bulkDownloadRequestId} using the bulkDownloadRequestId value, in the request body. This downloads a zip file containing documents.
To understand more visit the swagger link: https://platform.tradelens.com/documentation/swagger/