Rule
Conditions that make the Navixy platform log an event and notify someone when a tracker meets them.
A rule is a condition attached to trackers. When a tracker meets it, the platform logs an event and can notify a user about it, which is how speeding, geofence entry, low fuel, or an offline device turn into something a person sees.
A rule exists once and is bound to as many trackers as needed, so rule/create defines the condition and rule/bind decides which trackers it applies to. For a walkthrough, see how to create and use rules.
Rule object
type, param, and extended_params all depend on which rule is being created. Rule types documents them per type, along with the meaning of primary_text and secondary_text. Date, time, and local_time values follow the data types.
API actions
API base path: /tracker/rule.
Operations that list no errors of their own return only the general error codes.
Required sub-user rights: tracker_rule_update.
Apply an existing rule to more trackers.
Trackers that do not exist, belong to someone else, or are deleted are skipped silently rather than failing the call, so a success does not mean every ID in the list was bound.
Requires the tracker_rule_update right.
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 rule.
123Trackers to bind. Unknown or inaccessible IDs are ignored without error.
[265489]The rule was bound
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 201: no rule with this ID, or it belongs to another user.
Error response object
POST /v2/tracker/rule/bind HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 35
{
"rule_id": 123,
"trackers": [
265489
]
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - No rule with this ID, or it belongs to another user.
Required sub-user rights: tracker_rule_update.
Create a rule and its schedule intervals.
The rule goes in a rule object, not as top-level fields. Sending them flat is rejected with error 7.
Geofence binding differs by type: zone_ids is not allowed for the offline type, and cannot be empty for route or inoutzone. The rule types page documents param, extended_params, and the meaning of primary_text and secondary_text for each type.
Requires the tracker_rule_update right.
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.
The created rule
true if request finished successfully.
trueID of the new rule.
123Bad 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 204: an associated geofence does not exist.
Error response object
POST /v2/tracker/rule/create HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 464
{
"rule": {
"id": 668054,
"name": "Lock is opened/closed",
"type": "locking_unlocking",
"description": "text",
"zone_ids": [
18928
],
"trackers": [
1
],
"primary_text": "text",
"secondary_text": "text",
"param": 1,
"alerts": {
"sms_phones": [
"text"
],
"phones": [
"text"
],
"emails": [
"text"
],
"push_enabled": true,
"emergency": true
},
"suspended": true,
"auto_created": true,
"schedule": [
{
"type": "weekly",
"from": null,
"to": null,
"interval_id": 48732
}
],
"extended_params": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
}{
"success": true,
"id": 123
}Errors
These errors come in addition to the general error codes:
204 - An associated geofence does not exist.
Required sub-user rights: tracker_rule_update.
Delete a rule and everything related to it, including its schedule intervals.
Requires the tracker_rule_update right.
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 rule.
123The rule was deleted
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 201: no rule with this ID, or it belongs to another user.
Error response object
POST /v2/tracker/rule/delete HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"rule_id": 123
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - No rule with this ID, or it belongs to another user.
Get the rules bound to one tracker, or every rule on the account when tracker_id is omitted. Available to demo accounts.
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.
Optional. Return only rules bound to this tracker. Omit for every rule on the account.
999199The rules
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/tracker/rule/list HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 21
{
"tracker_id": 999199
}{
"success": true,
"list": [
{
"id": 668054,
"name": "Lock is opened/closed",
"type": "locking_unlocking",
"description": "text",
"zone_id": 0,
"trackers": [
1
],
"primary_text": "text",
"secondary_text": "text",
"param": 1,
"alerts": {
"sms_phones": [
"text"
],
"phones": [
"text"
],
"emails": [
"text"
],
"push_enabled": true,
"emergency": true
},
"suspended": true,
"auto_created": true,
"schedule": [
{
"type": "weekly",
"from": null,
"to": null,
"interval_id": 48732
}
],
"extended_params": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
]
}Required sub-user rights: tracker_rule_update.
Stop applying a rule to the given trackers. As with binding, unknown or inaccessible IDs are ignored without error.
Requires the tracker_rule_update right.
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 rule.
123Trackers to unbind. Unknown or inaccessible IDs are ignored without error.
[265489]The rule was unbound
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 201: no rule with this ID, or it belongs to another user.
Error response object
POST /v2/tracker/rule/unbind HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 35
{
"rule_id": 123,
"trackers": [
265489
]
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - No rule with this ID, or it belongs to another user.
Required sub-user rights: tracker_rule_update.
Replace a rule and its schedule intervals.
The rule goes in a rule object and must carry its id. As with creation, sending the fields flat is rejected.
Requires the tracker_rule_update right.
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.
The rule was updated
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 201: no rule with this ID, or it belongs to another user. Error 204: a newly associated geofence does not exist.
Error response object
POST /v2/tracker/rule/update HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 464
{
"rule": {
"id": 668054,
"name": "Lock is opened/closed",
"type": "locking_unlocking",
"description": "text",
"zone_ids": [
18928
],
"trackers": [
1
],
"primary_text": "text",
"secondary_text": "text",
"param": 1,
"alerts": {
"sms_phones": [
"text"
],
"phones": [
"text"
],
"emails": [
"text"
],
"push_enabled": true,
"emergency": true
},
"suspended": true,
"auto_created": true,
"schedule": [
{
"type": "weekly",
"from": null,
"to": null,
"interval_id": 48732
}
],
"extended_params": {
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}
}{
"success": true
}Errors
These errors come in addition to the general error codes:
201 - No rule with this ID, or it belongs to another user.
204 - A newly associated geofence does not exist.
Last updated
Was this helpful?