Skip to main content

/files (POST)

The API will allow you to generate a new file. Call the Files with the /files route.

Parameters​

reference required (max 255 char) The used file reference, as a string. This represents the barcode (scan code) value used in the barcode scanner, as well as the value used on the platform. Note: make sure to URL encode any special characters! Example value: reference=76543234567

close optional

A Boolean value which will indicate to close a file should a file with the existing reference already exist; if not supplied value is assumed to be “false” Example value: close=1

location optional

A location reference. A location in the API is what the platform calls a team (see Terminology). If not supplied, the file will be created in the first available known location. The location is a unique number and can be found in the platform, under “Teams”: select the team and the number will show in the header information.

Response values​

The content of the response will depend on the query parameters, the implemented features on Cargosnap as well as the actual available data. The typical response will be:

  • If file does not exist: “success”
  • If file already exists: “failed”, including the ID of the file that is currently open under that reference.
  • If file already exists and parameter “close=1” is set: “success” (so the existing open file will be closed and a new file will be returned).

Example Request​

POST https://api.cargosnap.com/api/v2/files?token=[MY-API-TOKEN]&reference=ABC12345&close=0&location=1

This query would: Return a 200 response code, with the URL to the report in the content body:

{
"response": "success",
"status": "File was successfully created",
"id": 183
}