Skip to content

UploadJobDoc

Uploads one document to a job, for all its work orders, or to a single work order. The document appears on the work order’s Documents tab, under For Job or For this Work Order only, and can be linked to items of the job’s document checklist. To list a job’s documents, use GetJobDocs. For the files of other records, such as bills, use UploadDoc.

How to sign in and read the response: Authentication, Responses.

Send the request as multipart/form-data, with the parts below and the file.

POST /api/v1/UploadJobDoc
Token: your-token
Content-Type: multipart/form-data; boundary=...
Part Required Meaning
JobID One of the two The job’s ID: the document is for the whole job, and shows on all its work orders.
WorkOrderID One of the two The work order’s ID: the document is for this work order only.
Title No The document’s title. Without it, the title is the file name without its extension. TrakIT keeps the first 300 characters.
IsPublic No true to give external users, such as the customer, access to the document: it is then marked Ext. Anything else, or nothing, keeps it internal.
Checklist No The names of the checklist items to link the document to, separated by ~, for example Bill of Lading~Commercial Invoice. Each name must be the item’s full name, in any case. Names that match no item of the job’s checklist are ignored.
The file Yes The file itself, in a file part of any name, for example file.

Send one file per request: if the request has several, only the first is saved.

Without Checklist, TrakIT links the document to the checklist items whose name pattern matches the file name, as it does for an upload in the app. Either way, the status of each linked checklist item is set to Pending.

Rule Info when it fails
The request is multipart/form-data. Unsupported media type
The request has a file. No Files Found
The file is not of a type that TrakIT always refuses, such as a program. Cannot upload this file type
The file is not empty. File size is zero
The file is at most 20 MB. File size cannot exceed 20MB
The file is of a type TrakIT accepts. The list is set for each TrakIT installation; by default it is PNG, JPG, JPEG, PDF, DOCX, XLSX and TIF. File extension not allowed
The file name is at most 300 characters. File name cannot exceed 300 characters
JobID and WorkOrderID, when given, are numbers. Parameter JobID must be a number, Parameter WorkOrderID must be a number
Exactly one of JobID and WorkOrderID is given. Either JobID or WorkOrderID must be provided, Only one of JobID or WorkOrderID must be provided
The work order exists and is active or abandoned. Work Order ... not found, Work Order is not active
With Checklist, the job exists. Job Not found
The custom validations that TrakIT Support may set for Upload Document on work orders pass. See Validations & actions. The validation’s own message
The job or work order has no document, not cancelled, with the same title, file name and size. Document with same title, file name and size already exists
The document can be saved: for example, JobID names a job that exists. Unable to add new Document

On success, Code is 1 and Identity is the new document’s ID, the DocID that GetJobDocs returns. RetInfo is null; ignore RowsAffected and Scalar.

{
"Code": 1,
"Info": "",
"RetInfo": null,
"RowsAffected": 1,
"Scalar": null,
"Identity": 304931
}

With curl, to upload a proof of delivery to one work order, open to external users and linked to the checklist item of that name:

Terminal window
curl -H "Token: your-token" -F "WorkOrderID=48211" -F "Title=Proof of delivery" -F "IsPublic=true" -F "Checklist=Proof of Delivery" -F "file=@pod-48211.pdf" https://trakit.example.com/api/v1/UploadJobDoc

Replace https://trakit.example.com with your TrakIT address.

  • The API user is shown as the person who uploaded the document. The upload is recorded in the audit log.
  • The custom actions that TrakIT Support may set for Upload Document run after the upload.
  • No one is notified by email: the Notify Users option of the app has no equivalent here.
  • PNG and JPG images larger than the installation’s maximum image size (800 pixels on the longer side by default) are scaled down when they are saved.
  • Sending the same file again with the same title is refused, so a retry cannot add it twice.