FAQ for API

Question List



How can I get historical positions of Tag?

There is two possibilities how to obtain historical positions of the Tag.

  • REST API
  • SAGE API

REST API – provide last 100 datapoints of datastream, per selected time range. Datastream can be posX, posY or different available datasream posZ, barometer, mag, etc. Example how results looks like and all available datasreams are listed in API Payload Examples.

Expected date format: D M d Y H:i:s e + , e.g. “Thu Oct 03 2013 07:03:41 GMT+0200 (Central Europe Standard Time)”.

However datasreams posX and posY are present as separated datasreams within the output. So programmer need to merge them based on timestamps.


SAGE API – provide all possible historical positions. There is possibility to obtain only positions per Tag ID. It can be fetched to pages if there are more positions then maximum per page. Maximum positions per page is 10000 (do not change this parameter). Verbose will show clr, number of used anchors for calculation and plan ID of the position. It is also possible to change time range of data.

Expected date format: YYYY-MM-DDThh:mm:ss.sZ, e.g. “1970-01-01T00:00:01.123Z” or “1970-01-01 00:00:01.123”

http://[SEVER IP]/sageserver/positions?id=[FEED ID]&per_page=10000&page=[PAGE NUMBER]&verbose=[BOOLEAN]&from=[TIME]&to=[TIME]

Example:

http://192.168.225.2/sageserver/positions?id=48&per_page=10000&page=1&verbose=true&from=1970-01-01%2000%3A00%3A01&to=2038-01-19%2003%3A14%3A07

Results:

This feature is available from RTLS Studio 1.6.0.


How can I find [id] for a Tag or search full-text within all feeds?

There is full-text search available with following syntax:

http://[SERVER-IP]/sensmapserver/api/feed?q=[attribute]

,where attribute can be MAC address, feed id, plan or description.



How to get Zone (Geo Fence) notifications?

For obtaining notifications from the zones can be used WebSocket connector.

Communication is based on publish-subscribe model, where client can subscribe to stream from zone and be immediately updated about change.

Subscribe to zone changes:

{“headers”:{“X-ApiKey”:”YOUR_KEY”},”method”:”subscribe”, “resource”:”/zones/YOUR_ZONE_ID”}

Unsubscribe to zone changes:

{“headers”:{“X-ApiKey”:”YOUR_KEY”},”method”:”unsubscribe”, “resource”:”/zones/YOUR_ZONE_ID”}

Example of zone change, for example tag with ID 23 entered zone with ID 2 at particular UTC time:

{“body”:{“feed_id”:”23″,”zone_id”:”2″,”status”:”in”,”at”:”2016-10-26 09:30:58.428415″},”resource”:”\/zones\/2″}

or tag left that zone 1 minute later:

{“body”:{“feed_id”:”23″,”zone_id”:”2″,”status”:”out”,”at”:”2016-10-26 09:31:58.428415″},”resource”:”\/zones\/2″}

More about WebSockets in API Documentation.


Why positions are not available via REST in real-time?

Firstly storing to DB must be activated in order to get positions via REST interface.

RTLS Studio -> RTLS Manager -> RTLS Server

In order to prevent server overloading with frequent DB position writes. Position are stored in a queue and written in DB in batches of app. 200 positions or after one minute of inactivity for tag. 

Since the REST interface obtain data from DB this latency is applied for REST queries. For strict real-time positioning with minimum latency please use Websockets or UDP connector.