Skip to content

UpdateEntity

Changes the details of an entity, as changing an entity in TrakIT does. Use it when your system learns a new address, email, tax number or other detail of a party that TrakIT already has, for example one created with CreateEntity.

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

POST /api/v1/UpdateEntity
Token: your-token
Content-Type: application/json
{
"EntID": 48211,
"Fields": [
{ "Address": "2 Example Road, Example City" },
{ "FinEmail": "billing@example.com" },
{ "Active": false }
]
}
Field Required Meaning
EntID Yes The entity’s ID, a whole number: EntID in the answers of CreateEntity, GetEntity and GetEntitiesUpdated.
Fields Yes The fields to change: a list of objects, each with one field and its new value. Put one field in each object: TrakIT reads only the first.

TrakIT reads EntID and Fields by name, and these two names are case-sensitive. The field names in Fields are not: EntName and entname are the same.

The fields are those of CreateEntity, with the same meanings and values. Fields you leave out keep their values. For example, { "PCID": 0 } removes the default profit centre, and { "SCAC": null } removes a carrier’s shipping line.

The entity’s types cannot be changed here: EntType and Types are refused. To add or remove its other types, use UpdateEntityTypes. Its logo, Agreed to WhatsApp, its entity data fields and its Per Company accounts cannot be changed here either.

TrakIT checks the request, reads the fields in the order you send them and stops at the first one it refuses. It then checks the whole entity as the entity page does, so a value already saved that the page would refuse also stops the change. Nothing is saved unless every check passes.

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
EntID is a whole number above 0. EntID missing or invalid
Fields is a list with at least one field. No field list found
An entity has that ID. No such entity
Each item of Fields is an object holding a field. Each item of Fields must be an object holding one field
No field is EntType or Types. Entity types cannot be changed here
Each field, and the entity as changed, passes the checks of CreateEntity. Their messages, for example Profit center ... is not an active profit center of company ...

The profit centre and currency are checked when you send them or change RespOffice. When you change the responsible company, send PCID and CurrCode too if the entity’s current ones do not belong to the new company: 0 and null remove them.

On success, Code is 1, Info is empty and Identity is the entity’s ID. Read the entity with GetEntity to see it.

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

When the fields you send hold the values the entity already has, nothing is saved: Code is 1 and Info is No changes made.

  • The change is recorded in the entity’s Action Log under the API user’s name, with the old and new values.
  • When you change the responsible company, the new company is enabled for the entity on the Per Company tab. When you change the name, TrakIT also updates it in the data fields that refer to the entity.
  • Any change removes the entity’s approval, if its type needs one: a user approves it again in TrakIT.
  • TrakIT then runs your company’s actions for changing an entity, tells the users who subscribed to entity notifications, and recalculates the entity’s computed data fields, copying those that changed to the data of its work orders.