Upload Files

POST v2/{modelType}/{modelID}/files

Uploads file: Use a multipart form. The file should be in the field 'file' and the description_id should be in the field description.

Description
Value

Rate Confirmation

1

Pickup Document (BOL)

2

Miscellaneous

3

The Endpoint

POST https://api.test.archer-app.com/v2/loads/999999/files

Examples

cURL

curl --request POST \
  --url https://api.test.archer-app.com/v2/loads/999999/files \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --cookie 'auth-server-token=TOKEN;' \
  --form file=confirmation.pdf \
  --form description=1

JavaScript

var data = new FormData();
data.append("file", "~/confirmation.pdf");
data.append("description", "1");

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.test.archer-app.com/v2/loads/999999/files");
xhr.setRequestHeader("cookie", "auth-server-token=TOKEN;");

xhr.send(data);

Body Object

None

ExampleBody

None


Response

Returns the file information.

Response Properties

Name
Type
Description

id

int

File Id.

modelType

string

Model name.

modelId

int

Model Id.

description

int

Description Id.

name

string

The file name.

Example Response

{
  "id": 12,
  "modelType": "Load",
  "modelId": 999999,
  "description": "Rate Confirmation",
  "name": "loads_999999_Rate Confirmation_150000000.pdf"
}

Example Error Response

When the User is trying to upload a file to an object that is not one of their own.

{
  "message": "The load number 99999999 is not a valid load for this user.",
  "title": "Internal Error"
}


Last updated