Upload Files
curl --request POST \
--url https://logistics.api.smartcp.org/v1/orders/{order_id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Client-Directory: <api-key>' \
--form 'files=<string>' \
--form files.items='@example-file'const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'X-Client-Directory': '<api-key>'}
};
options.body = form;
fetch('https://logistics.api.smartcp.org/v1/orders/{order_id}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://logistics.api.smartcp.org/v1/orders/{order_id}/files"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = { "files": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"X-Client-Directory": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://logistics.api.smartcp.org/v1/orders/{order_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Client-Directory: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": 201,
"message": "Created",
"data": {
"message": "Files attached successfully",
"order_id": 4036230,
"uploaded": [
{
"id": 157,
"name": "CMR.pdf",
"category_id": 1
}
],
"failed": []
}
}Orders
Upload Files
Uploads one or more files and attaches them to the selected order. Each file can be up to 10 MB.
POST
/
orders
/
{order_id}
/
files
Upload Files
curl --request POST \
--url https://logistics.api.smartcp.org/v1/orders/{order_id}/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Client-Directory: <api-key>' \
--form 'files=<string>' \
--form files.items='@example-file'const form = new FormData();
form.append('files', '<string>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'X-Client-Directory': '<api-key>'}
};
options.body = form;
fetch('https://logistics.api.smartcp.org/v1/orders/{order_id}/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://logistics.api.smartcp.org/v1/orders/{order_id}/files"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = { "files": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"X-Client-Directory": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://logistics.api.smartcp.org/v1/orders/{order_id}/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Client-Directory: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": 201,
"message": "Created",
"data": {
"message": "Files attached successfully",
"order_id": 4036230,
"uploaded": [
{
"id": 157,
"name": "CMR.pdf",
"category_id": 1
}
],
"failed": []
}
}Authorizations
Client API key sent as a bearer token.
Client directory identifier. Legacy directory header is still accepted for backward compatibility.
Path Parameters
Order ID.
Body
multipart/form-data
⌘I