1

custom temperature report using the api

Topic: custom temperature report using the api

Hello.

We have a situation where we need to generate a report, that can't be done from the Wialon reports system. It is for a client who makes cold transportation and his customers ask for a specific type of report, which must contain the following columns for a specific interval:

Total number of measurements
Average temperature
Number of measurements for custom temperature ranges (for example how many measurements were made for temp range between 5 and 10 degrees)
Percentage of custom temperature ranges

For the moment i have just a "Sensor tracing" template made in Wialon,  from which i can extract the data, but i need a hint on how to generate it and how to get data from specific columns and put them into JSON arrays using the API.

Thanks!

2

custom temperature report using the api

(edited by kaippally 10/09/2017 16:21:24)

Re: custom temperature report using the api

1) Load the web form http://hosting.wialon.com/login.html
2) Enter your user login and password, press "login"
3) If authorisation was ok, in the web address field you will get the response with the token like

http://hosting.wialon.com/login.html?access_token=5bbfe4a4ad20f61f466ae093aeb811d3BB4432702CE8BC771547D35F32E0A0E64FAE40B6&svc_error=0

access_token=5bbfe4a4ad20f61f466ae093aeb811d3BB4432702CE8BC771547D35F32E0A0E64FAE40B6- this will be your token

The default token has several limitations, you can extand its access rights if you add the Additional parameters in the request from the specification https://weblog.gurtam.com/wp-content/up … hod_EN.pdf

4) After you get the token, you will be able to login under it.


https://hst-api.wialon.com/wialon/ajax.html?svc=token/login&params={"token":"5bbfe4a4ad20f61f466ae093aeb811d3BB4432702CE8BC771547D35F32E0A0E64FAE40B6"}

For all subsequent queries you will use the eid from the login response as the sid (Session Id)
5) In order to query report you will need to know the Resource ID and report Template ID .

So query available resources .

https://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec": {
                    "itemsType": "avl_resource",
                    "propName": "sys_name",
                    "propValueMask": "*",
                    "sortType": "sys_name"
                },
                "force": 1,
                "flags": "8193",
                "from": 0,
                "to": 0
            }&sid=0416be7911e7a2cedd6bba0ae68e9c4e

Once you get the resource and report template make a query

https://hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&params={
"reportResourceId":13786188,
"reportTemplateId":13,
"reportObjectId":14224227,
"reportObjectSecId":0,
    "interval":{
    "from":1490040000,
    "to":1490126399,
    "flags":0
    }
}&sid=0416be7911e7a2cedd6bba0ae68e9c4e

The result will have the total number of rows available

Now query for all the rows.

https://hst-api.wialon.com/wialon/ajax.html?svc=report/select_result_rows&params={
"tableIndex":0,
"config":{
"type":"range",
"data":{"from":0,"to":7,"level":1}
}}&sid=0416be7911e7a2cedd6bba0ae68e9c4e
Nishad Hussain Kaippally
Implementation Specialist, Middle East, Gurtam

"Computer science is no more about computers than astronomy is about telescopes."
3

custom temperature report using the api

Re: custom temperature report using the api

As i check to get all unit with its position i need details of the unit same as current wialon application have in their unit info and history page

i use APi

https://gps.tawasolmap.com/wialon/ajax. … p;params={
"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"*","sortType
":"sys_name","propType":"creatortree"},"force":1,"flags":4611686018427387903,"from":0,"to"
:1000}}],"flags":0}&sid=aa47dcb8c316d24358026924efeae7c8

what would be field that i need to use for the below perimeters https://sdk.wialon.com/wiki/en/local/re … ormat/unit

Unit Name items[0][nm]
Unit id items[0][id]
Unit Latitude    items[0][pos][x]
Unit Longtude    items[0][pos][y]
Speed of the car items[0][pos][s]
Engine  status
In parking or driawing
Address of the unit
image for  the unit
Engine time of the unit

which are the field says for the remain filels

  • custom temperature report using the api