1

Difference between events

(26/11/2022 18:47:18 отредактировано hhamedk)

Тема: Difference between events

Dear GT

In APIs we have:
https://sdk.wialon.com/wiki/en/local/re … data_flags

And

https://sdk.wialon.com/wiki/en/local/re … date_units

Would you please explain in detail what is the difference between these two sort of APIs?

Also the same for checking the events:
https://sdk.wialon.com/wiki/en/local/re … ck_updates

and

https://sdk.wialon.com/wiki/en/local/re … s/avl_evts

Please let me know what is the difference, are these some how alternatives of each other? Is there exact use case for each one?


What we are looking for is to receive the last position of units with all possible sensors values. Is it possible to get them only by one of these APIs? Please advise us how to reach this goal in easiest way.
Just like Wialon Web, we need to have last position of unit and all the sensors (in monitoring tab)

2

Difference between events

(26/11/2022 18:40:36 отредактировано hhamedk)

Re: Difference between events

Up

zant
Diana

3

Difference between events

Re: Difference between events

hhamedk  hello, sorry for the delay.

The update_data_flags allows to control the changes applied in any item in the system.
For example, you can add all units there with "avl_unit" value for "data" parameter and with "avl_evts" request execution control the changes in the unit's properties or last known location.
The type of changes that you want to control can be regulated with flags values, same that used for search_items request.
For example, if you want to control location update, you can try to use following request parameters:
hst-api.wialon.com/wialon/ajax.html?svc=core/update_data_flags&params={"spec":[{"type":"type","data":"avl_unit","flags":1025,"mode":0}]}&sid=
Then you can execute hst-api.wialon.com/avl_evts?sid= to check for any updates.

The sample of the executions by steps -- https://sdk.wialon.com/wiki/en/sidebar/ … datafalags

But this request can control only parameters values changes and not the sensor values.

For the sensors you can use update_units request and add required units there to control sensors, trips, counters changes. check_updates request will show the result.

Here you can find video tutorial with the events description --  https://youtu.be/nUtNS5Al5wo

So, in general, you can try to use both these requests to get required information - update location and sensor values.
Or use 'load_last' request to get location and events for the sensors.

P.S. to get 24/7 support you can also provide your request to support@gurtam.com

Anton Zinovyev
Technical Care Engineer (L2)
Wialon
4

Difference between events

Re: Difference between events

zant, thank you for your explanation.
So, you say that there is no way to receive the last position of unit and all the sensors with only one request?

5

Difference between events

Re: Difference between events

hhamedk , you can try to use core/batch request to get sensor value from last message and sensor value as well.
Thus you need to combine two requests - unit/calc_last_message and messages/load_last

For example, https://hst-api.wialon.com/wialon/ajax.html?svc=core/batch&params={"params":[{"svc":"messages/load_last","params":{"itemId":UNIT_ID,"lastTime":1670233953,"lastCount":1,"flags":1,"flagsMask":65281,"loadCount":1}},{"svc":"unit/calc_last_message","params":{"unitId":UNIT_ID,"sensors":[],"flags":0}}],"flags":1}&sid=ACTIVE_SID

You can replace calc_last_message request with event request to get last known value of the sensors.

Anton Zinovyev
Technical Care Engineer (L2)
Wialon