Attach documents to a shipment
To attach documents to a shipment, you must use the POST method on the /v1/shipments/{identification}/attachments route.
The identification parameter can be the shipment ID or the tracking code.
- Shipment Id : always returns in the
shipment_idfield - Shipment Tracking: always returns in the
tracking_codefield
Endpoint: /v1/shipments/{id}/attachments
http
POST /v1/shipments/{identitication}/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: application/json
Accept: application/json
{ json | formData }
This method supports sending binary files in the multipart/form-data format or public urls via json application/json.
Obs: The URL parameter id can be the shipment ID or the tracking code.
Parametros:
| Property | Required | Type | Description |
|---|---|---|---|
| attachments | Y | Array | Array |
| document_code | N | String | If attachment is a document |
| file_name | Y | String | File name |
| url | Y | Integer | File Public URL |
Example request
Send json with urls:
http
POST /v1/shipments/1/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: application/json
Accept: application/json
{
"attachments" : [
{
"url" : "https://tristarexpress.com/wp-content/uploads/2022/07/AF_logotipo_tristar_EXPRESS_NEGATIVO.png",
"document_code" : "DOCUMENT"
},
{
"url" : "https://tristarexpress.com/wp-content/uploads/2022/07/AF_logotipo_tristar_EXPRESS_NEGATIVO.png",
"file_name" : "CPF.png",
"document_code" : "DOCUMENT"
}
]
}
Send binary files:
http
POST /v1/shipments/1/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: multipart/form-data
Accept: application/json
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[0][file]"; filename="Arquivo.png"
Content-Type: <Content-Type header here>
(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[0][document_code]"
DOCUMENT
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[1][document_code]"
DOCUMENT
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[1][file]"; filename="Arquvio2.png"
Content-Type: <Content-Type header here>
(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--

