Entity fields
Custom fields added to an entity, and the types they can take.
A field adds custom information to an entity. Each field belongs to exactly one entity, so a custom field defined on places exists only on places.
Field object
Field types without special parameters
text- text of up to 700 Unicode characters.bigtext- text of up to 20,000 Unicode characters, with reduced search and sorting.email- an email address, validated as one.phone- a phone number, validated as one.decimal- a decimal from -999999999999.999999 to 999999999999.999999, stored to six decimal places.integer- an integer from-2^63to2^63 - 1.
Field types with special parameters
employee links the entity to an employee. It takes one special parameter:
{
"responsible": true
}responsible- boolean. Only one employee field per entity can set this totrue.
Setting responsible has an effect in the Mobile Tracker App, for Android and iOS. When an employee is assigned to a device running the app, and a place carries a responsible-employee field naming them, that place becomes visible to them in the app. This is what lets an employee see the places they are expected to visit.
API actions
API base path: /entity/fields.
The entity ID comes from entity/list.
Return the custom fields associated with an entity.
The entity ID comes from entity/list.
Also accepts GET with the same parameters as query-string values.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the entity.
The custom fields
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error response object
POST /v2/entity/fields/read HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"entity_id": 1
}{
"success": true,
"list": [
{
"id": null,
"label": "text",
"type": "text",
"required": true,
"description": "text",
"params": {
"responsible": true,
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
]
}Errors
These errors come in addition to the general error codes:
201 - Not found in the database, when no entity has the given ID.
A field sent with id set to null is created. A field sent with an existing id keeps its type, which cannot be changed. Every field on one entity must have a different label, and an id belonging to no field, or to a field on another entity, is rejected.
When delete_missing is true, every existing field left out of the fields list is permanently deleted. When it is false, those fields are untouched.
Required sub-user rights: places_custom_fields_update for fields on the place entity.
Create, update and optionally delete the custom fields of an entity in one call, and return all of the entity's fields afterwards, with new IDs filled in.
Four rules govern what may be sent. A field with id null is created. A field that already exists keeps its type, which cannot be changed. All fields on one entity must have different label values. An id that does not exist, or belongs to another entity, is an error.
delete_missing is destructive. When true, every existing field absent from fields is permanently deleted. It defaults to false, which leaves them alone.
The required right depends on the entity type: place needs places_custom_fields_update, and other types need the right their own product defines.
Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.
ID of the entity.
Optional. Default false. When true, existing fields absent from fields are permanently deleted.
All fields of the entity, after the change
true if request finished successfully.
trueBad request. The response body carries the API-level error code in status.code. Validation failures also include an errors array naming each offending parameter.
Error 13: the caller lacks the right that governs this entity type.
Error response object
POST /v2/entity/fields/update HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 193
{
"entity_id": 1,
"fields": [
{
"id": null,
"label": "text",
"type": "text",
"required": true,
"description": "text",
"params": {
"responsible": true,
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
],
"delete_missing": true
}{
"success": true,
"list": [
{
"id": null,
"label": "text",
"type": "text",
"required": true,
"description": "text",
"params": {
"responsible": true,
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
]
}Errors
These errors come in addition to the general error codes:
7 - Invalid parameters, when the fields violate the restrictions above.
201 - Not found in the database, when no entity has the given ID.
Last updated
Was this helpful?