Skip to content

UpdateJobHeader

Changes the header fields that belong to a whole job rather than to one work order: its customer, shipper, receiver, job types, cargo type and Incoterms. This is what the job fields of Edit work order do in TrakIT, and the change applies to every work order of the job. Use it when your system learns one of these details after the job was created with CreateJob. To change the fields of one work order, such as its container number or transporter, use UpdateWOHeader.

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

POST /api/v1/UpdateJobHeader
Token: your-token
Content-Type: application/json
{
"JobID": 10457,
"Fields": [
{ "ShipperID": 3022 },
{ "ReceiverID": 3021 },
{ "IncoTerms": "FOB" }
]
}
Field Required Meaning
JobID Yes The job’s ID, a whole number: JobID in the answers of CreateJob, GetJob and GetWO.
Fields Yes The fields to change: a list of objects, each with one field from the table below and its new value. Put one field in each object: TrakIT reads only the first.

TrakIT reads JobID and Fields by name, and these two names are case-sensitive. The field names in Fields are not: ShipperID and shipperid are the same.

The fields have the names CreateJob gives them. Fields you leave out keep their values.

Field Meaning
CusID Customer: an entity ID, or 0 to remove the customer.
ShipperID Shipper: an entity ID, or 0 to remove it.
ReceiverID Receiver: an entity ID, or 0 to remove it.
JobType Job Type: a list of job type IDs, also for a single one: [2]. The list replaces the job’s job types, and [] removes them all. Each must be one of the workflow’s job types, or one the job already has. TrakIT Support can give you the IDs.
CargoType Cargo Type, as a number: see Cargo types. null removes it.
IncoTerms Incoterms: one or more of EXW, FCA, FAS, FOB, CFR, CIF, CPT, CIP, DPU, DAP and DDP, separated by commas, for example FOB,CIF. Capitals and spaces do not matter. TrakIT stores them as Edit work order does: in alphabetical order, separated by a comma and a space (CIF, FOB). An empty text or null removes them.

Send the IDs and CargoType as JSON numbers, and IncoTerms as text. For the customer, shipper and receiver a null is refused: send 0 to remove one. As in CreateJob, any entity can be the customer, shipper or receiver: TrakIT does not check the entity’s type.

The job reference (Transport Document) and Remarks For Job cannot be changed here.

TrakIT checks the request and the job, then reads the fields in the order you send them and stops at the first one it refuses. Nothing is saved unless every check passes.

TrakIT saves the change through the job’s first open work order, the one with the lowest ID, as if a user changed these fields on its Edit work order page. So that work order’s header must also pass the checks of UpdateWOHeader as it stands, for example on its seal number and weight.

Rule Info when it fails
The Token header holds a valid token. Token missing in header, Token invalid or expired, or another answer listed in Login token
The user is a system administrator with API access. API User must be SysAdmin with API Access
The request has a JSON body. No request body found
JobID is a whole number above 0. JobID missing or invalid
Fields is a list. No field list found
A job has that ID. No such job
The job has an open work order: active or abandoned, not closed or cancelled. Job ... has no open work order
Each item of Fields is an object holding a field. Each item of Fields must be an object holding one field
Each field is one of the fields above. ... is not recognized or supported
CusID, ShipperID and ReceiverID are whole numbers, 0 or more. CusID should be an entity ID, or 0, ShipperID should be an entity ID, or 0, ReceiverID should be an entity ID, or 0
A new customer, shipper or receiver is an entity whose mandatory entity data fields are filled in. No such entity, Error: Entity '...' Mandatory data field '...' is missing
JobType is a list of whole numbers. JobType must be a list of job type IDs, Job Type IDs must be integers
Each job type is one of the workflow’s, or one the job already has. Job Type ... is not available in the job's workflow
CargoType is one of the cargo types, or null. CargoType is not valid
IncoTerms is text holding only the terms above. IncoTerms must be text, IncoTerms is not valid
The first open work order’s header passes the checks of UpdateWOHeader. Their messages, for example Seal Number contains invalid characters
Your company’s validations for Save WO Header and Save Job Header pass. Their own messages

On success, Code is 1, Info is empty and RetInfo is null. Read the job with GetJob to see it.

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

When the fields you send hold the values the job already has, also in another order or spelling, nothing is saved: Code is 1 and Info is No changes made.

  • The fields are kept once for the whole job, so every work order of the job shows the new values, closed and cancelled ones included.
  • The change is recorded in the job’s audit log under the API user’s name.
  • The data fields of the job’s customer, shipper and receiver are copied to the events and data of its work orders where your company has set that up: see Copy values to work orders.
  • If the workflow’s WO Auto Reset is set for Job Type or Customer (see Workflow settings) and that field changes, TrakIT resets the events and data of every open work order of the job, keeping the values already entered.
  • TrakIT then runs your company’s actions for Save WO Header on the first open work order, and tells the users who subscribed to Update WO Header notifications about that work order, as when a user changes the job from it. It also recalculates the job’s KPIs and computed data fields.
  • Send the values your workflow requires: a header field that it makes Mandatory in its header fields should not be removed.