1

Get location data for all units within a time margin

Тема: Get location data for all units within a time margin

I am using the Wialon Remote API

I would like to do something along the lines of https://hst-api.wialon.com/wialon/ajax.html?svc=messages/load_interval&params={"itemId":xxx, "timeFrom":xxx,"timeTo":xxx, "flags":1, "flagsMask":65281,"loadCount":30}sid=<sid>

But I do not wish to make this request for every itemId. Is there a supported method for getting the gps positions of all units within the past, say 25 seconds?

Thank you.

2

Get location data for all units within a time margin

Re: Get location data for all units within a time margin

Hello!

You can get new coming messages via request avl_evn.

First (after login) it needs to add required elements with required data flags (which info get) via request core/update_data_flags

For example, let add units by list of IDs:
"type":"col",
"data":[array_with_id_list],
"flags":32
(get messages data from unit )

(To get all accessible unit you can specify: "type":"type","data":"avl_unit"  )

https://hst-api.wialon.com/wialon/ajax.html?svc=core/update_data_flags&sid=021739657925b2684c0a4fc39273&params={"spec":[{"type":"col","data":[21414],"flags":32,"mode":1}]}

Then execute request

https://hst-api.wialon.com/avl_evts?sid=021739657925b26842b78c0a4fc39273

The response - show the last message

{"tm":1612185621,"events":[{"i":21728414,"t":"m","d":{"t":1612185620,"f":1073741863,"tp":"ud","pos":{"y":42.1454546667,"x":-123.3,"c":0,"z":300,"s":0,"sc":8},"i":0,"o":0,"dr":"br23","lc":0,"rt":1612185621,"p":{"avl_driver":"br23","pass":"E2000020340F02371900D866","mil":1001,"ves":"9000","tco_distance":1490,"tco_activity_tm":400,"fuel":220.79,"tco_driver1_id":"rettt"}}}]}

Again execute avl_evts

The response  - The new messages has been coming

{"tm":1612185726,"events":[{"i":21728414,"t":"m","d":{"t":1612185650,"f":1073741863,"tp":"ud","pos":{"y":42.1454546667,"x":-123.3,"c":0,"z":300,"s":0,"sc":8},"i":0,"o":0,"dr":"br23","lc":0,"rt":1612185651,"p":{"avl_driver":"br23","pass":"E2000020340F02371900D866","mil":1001,"ves":"9000","tco_distance":1490,"tco_activity_tm":400,"fuel":220.79,"tco_driver1_id":"rettt"}}},{"i":21728414,"t":"m","d":{"t":1612185650,"f":1073872395,"tp":"xx","rt":0,"p":{}}},{"i":21728414,"t":"m","d":{"t":1612185680,"f":1073741863,"tp":"ud","pos":{"y":42.1454546667,"x":-123.3,"c":0,"z":300,"s":0,"sc":8},"i":0,"o":0,"dr":"br23","lc":0,"rt":1612185681,"p":{"avl_driver":"br23","pass":"E2000020340F02371900D866","mil":1001,"ves":"9000","tco_distance":1490,"tco_activity_tm":400,"fuel":220.79,"tco_driver1_id":"rettt"}}},{"i":21728414,"t":"m","d":{"t":1612185710,"f":1073741863,"tp":"ud","pos":{"y":42.1454546667,"x":-123.3,"c":0,"z":300,"s":0,"sc":8},"i":0,"o":0,"dr":"br23","lc":0,"rt":1612185711,"p":{"avl_driver":"br23","pass":"E2000020340F02371900D866","mil":1001,"ves":"9000","tco_distance":1490,"tco_activity_tm":400,"fuel":220.79,"tco_driver1_id":"rettt"}}}]}

Next response

{"tm":1612185743,"events":[]}

means that are not  yet any new messages

So you can execute request each 25 seconds (or often) to get last coming messages.

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Get location data for all units within a time margin

Re: Get location data for all units within a time margin

Thank you I will try this workflow!