Tags
The meta-data of tags can be retrieved via the REST API. Only users with one of the following roles can access the tracking REST API:
- Site creator
- Site admin
- Tracking manager
The API authentication token is used for authentication, it can be retrieved on your Profile page on NAO Cloud. Once you have the authentication key, you can make requests against the nao_trackables endpoint.
To get information of all the tags of the site, use the following API:
1 | GET /api/v2/sites/{siteID}/nao_trackables |
Ex:
Request:
Response:
7 | "tracking_id":"092353", |
8 | "loc_updated_at":"2018-04-06T14:05:29Z", |
11 | "mac_address":"11:22:33:44:55:66", |
12 | "adv_id_full":"iBeacon@B233860B5F9D44EFB657C2966D89BBFB:8000:100", |
13 | "new_batteries_at": "2018-05-01T00:00:00Z", |
14 | "estimated_end_of_life": "2023-05-01T00:00:00Z" |
Possible optional options:
- ids: list of IDs, separated by comma (,)
- tracking_ids:list of Tracking IDs, separated by comma (,)
- categories: list of categories, separated by comma (,)
Ex:
Request:
Tag filtering
The REST API allows filter using the following attributes: tracking_id, is_active, category, name, battery. To filter, please add the following parameter filter[<attribute_name>_<ransack_matcher>]. The most used ransack machers are eq (equals) and in (match any values in array). Refer to Ransack for more matchers.
To get tags with a given tracking ID (MAC address), add the following parameter filter[tracking_id_eq]=<tracking_id>
To get tags with in a list of given tracking IDs (MAC addresses), add the following parameter filter[tracking_id_in][]=<tracking_id_1>&filter[tracking_id_in][]=<tracking_id_2>
To get tags with a given name, add the following parameter filter[name_eq]=<name>
If there are no conflict between the tracking_id and the name, the filter[tracking_id_or_name_in]=<tracking_id>,<name> parameter can be used.
The REST API can be used to create, update and delete tags. For more information, please refer to the REST API documentation.
Regions/Zones
In the same way, to get information of all the zones of the site, use the following API:
1 | GET /api/v2/sites/{siteID}/regions |
Ex:
Request:
Response:
6 | "type":"PolygonRegion", |
7 | "polygon":"[[4.001915320729633,49.21828208973843],[4.002036503461478,49.21842478973541],[4.002285696121327,49.21832668353172],[4.0021781677818025,49.218194016878414],[4.001915320729633,49.21828208973843]]", |
Alerts
To get information of all the alerts of the site, use the following API:
1 | GET /api/v2/sites/{siteID}/alerts |
Ex:
Request:
Response:
6 | "name":"My alert name", |
10 | "nao_application_id":4972, |
14 | "type":"EnterGeofenceRule", |