Download a document attached to a shipment
You can download documents using two methods:
- If the webhook shipment
documentcontains anobjectId: Download the supplier’s document from the Tradecloud object-storage using theobjectIdanddownloadUrl. - If the webhook shipment
documentcontains anurl: Download the document from the supplier’s content server.
Method 1. Download the document from the Tradecloud object-storage
Section titled “Method 1. Download the document from the Tradecloud object-storage”
Step 1. Retrieve the objectId from the document
Section titled “Step 1. Retrieve the objectId from the document”Please check the documents fields in:
"documents": [ { "code": "10007563", "revision": "B", "name": "Tradecloud API Manual", "description": "General document", "type": "General", "objectId": "05d251f0-0166-4e1e-8110-8d7a507b18f4", "meta": { "lastUpdatedAt": "2019-12-31T10:11:12" } }],In this example the objectId is:
05d251f0-0166-4e1e-8110-8d7a507b18f4
Step. 2. Retrieve the downloadUrl from the object storage
Section titled “Step. 2. Retrieve the downloadUrl from the object storage”GET https://api.accp.tradecloud1.com/v2/object-storage/document/{objectId}/metadata
Get document metadata
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
objectId |
string | no | document objectId |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization |
string | no | Bearer Access-Token |
Response 200
{ "id": "05d251f0-0166-4e1e-8110-8d7a507b18f4", "filename": "test.pdf", "contentType": "application/octet-stream", "downloadUrl": "`downloadUrl`"}
Step 3. Download the document using the downloadUrl
Section titled “Step 3. Download the document using the downloadUrl”Just GET the downloadUrl
Method 2. Download the document from the supplier content server
Section titled “Method 2. Download the document from the supplier content server”
Step 1. Retrieve the url from the document
Section titled “Step 1. Retrieve the url from the document”Please check the documents fields in:
"documents": [ { "code": "10007563", "revision": "B", "name": "Tradecloud API Manual", "description": "General document", "type": "General", "url": "http://supplier.com/content/manual.pdf", "meta": { "lastUpdatedAt": "2019-12-31T10:11:12" } }],In this example the url is:
http://supplier.com/content/manual.pdf
Step 2. Download the document using the url
Section titled “Step 2. Download the document using the url”Just GET the url
