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”
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:
,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:
Unsubscribe to zone changes:
Example of zone change, for example tag with ID 23 entered zone with ID 2 at particular UTC time:
or tag left that zone 1 minute later:
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.