1

Wialon Get Unit list API

(edited by trushal.shah 21/09/2020 12:40:01)

Topic: Wialon Get Unit list API

We love develope some custom applications based on Wialon

could you help me which API should i call to get logged in the user's  list of units and its location details?

As i do login and get authorize token and sid=eid after that i stuck that how i can get the login user-item collection and its details

Server access 1904

https://hst-api.wialon.com/wialon/ajax. … arch_items

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,
"from":0,"to":1000}}]   
,"flags":0}&sid=755407f57fdb182a7b1e1dc19288fc3e


Was tray to get this but getting error like {"error":1, "r":"0-0"}   

1) Login user[As per SID-Eid] all unit lists data as per wailon App page
2) Login user[As per SID -Eid] unit details data as per the wailon App page
3) Report of the unit between dates
4) Notification list 

As i looking for to check the same as the current store app for unit collection and its details
is there any Mobile APi collection that i can import to my postman and start accessing all working API that would save time to manage access

2

Wialon Get Unit list API

Re: Wialon Get Unit list API

Hello!

To search units by parent-creator (parent + subaccount) you need to use request  core/search_items with the following parameters:

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where in "propValueMask" you need to specify user's ID (you can get his ID for example after login)

Error1 means invalid session, please make sure that after login you execute other request at once, the session is alive during 5 minutes without any requests. To hold session you can execute simple request avl_evts , for example, each 2-3 sec

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Wialon Get Unit list API

Re: Wialon Get Unit list API

Thanks for the reply,

it works,

One more help if you can please do,

how I can get for info about units

1. Info of the unites with its status and location
2. History of the unit as per date more details. for e.g, i have attached a screenshot 

thanks for your time

4

Wialon Get Unit list API

(edited by megb 11/11/2020 18:56:52)

Re: Wialon Get Unit list API

chdi wrote:

Hello!

To search units by parent-creator (parent + subaccount) you need to use request  core/search_items with the following parameters:

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where in "propValueMask" you need to specify user's ID (you can get his ID for example after login)

Error1 means invalid session, please make sure that after login you execute other request at once, the session is alive during 5 minutes without any requests. To hold session you can execute simple request avl_evts , for example, each 2-3 sec

Hello Diana,
i had tried your request example but always get error 4 wrong params.
Can you advice please ?

5

Wialon Get Unit list API

(edited by trushal.shah 12/11/2020 08:44:19)

Re: Wialon Get Unit list API

megb wrote:
chdi wrote:

Hello!

To search units by parent-creator (parent + subaccount) you need to use request  core/search_items with the following parameters:

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where in "propValueMask" you need to specify user's ID (you can get his ID for example after login)

Error1 means invalid session, please make sure that after login you execute other request at once, the session is alive during 5 minutes without any requests. To hold session you can execute simple request avl_evts , for example, each 2-3 sec

Hello Diana,
i had tried your request example but always get error 4 wrong params.
Can you advice please ?



Step 1 call below API

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

https://hst-api.wialon.com/wialon/ajax. … login&
    params={
        "token":"2fe8024e0ab91aa6c8ed82717b71bddcECDC362358DF7D90986F5173D405CD0D42DE7B38",
        "operateAs":"sdk_test"
    }


In response you get

"host": "212.98.173.107",
"eid": "d1cb60897768780f846df7ab2400eb5f",

this eid is same as sid, so in the sid used eid value

Step 2
call below API
http://ghst-api.wialon.com: is your host url

http://ghst-api.wialon.com/wialon/ajax.html?svc=core/search_items&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=d1cb60897768780f846df7ab2400eb5f

"flags":4611686018427387903 would be as per your requirement you can access from below URL

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

6

Wialon Get Unit list API

Re: Wialon Get Unit list API

thanks that's works

7

Wialon Get Unit list API

Re: Wialon Get Unit list API

chdi wrote:

To search units by parent-creator (parent + subaccount) you need to use request  core/search_items with the following parameters:

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where in "propValueMask" you need to specify user's ID (you can get his ID for example after login)
...

Hi,
You explained here how to get units for a specific user. How do I modify this request to get units for all the users?

Thank you.

8

Wialon Get Unit list API

Re: Wialon Get Unit list API

gvg wrote:
chdi wrote:

To search units by parent-creator (parent + subaccount) you need to use request  core/search_items with the following parameters:

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where in "propValueMask" you need to specify user's ID (you can get his ID for example after login)
...

Hi,
You explained here how to get units for a specific user. How do I modify this request to get units for all the users?

Thank you.

Hello!

Sure it depends what do you mean about all the users.

For example, we login under top-user or second-level user (after top in hierrhy) , by default (it top-user doesn't restrics acess rights) this user has acess to all users and thier units . In this case you can just to execute request to searh items by name with name mask *

For example

hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&params={"spec":{"itemsType":"avl_unit","propName":"sys_name","propValueMask":"*","sortType":"sys_name"},"force":1,"flags":1439,"from":0,"to":200}}],"flags":0}&sid=0207c58abf39ae543e732387

If you need something else, please decribe your particular task

Diana Cheley
Wialon Hosting Expert
Gurtam
9

Wialon Get Unit list API

Re: Wialon Get Unit list API

Well, I have an account (web.lematics.lt) in which I see a number of clients (Users, I suppose according to Gurtam terminology?). Every user has some objects that he/she wants to control (Units in Gurtam terminology?) I want to get a table through API were I can see all my users with all the units that they control. Is this possible?

10

Wialon Get Unit list API

Re: Wialon Get Unit list API

Hello!

All users have access only to own units, some user doesn't have access (control) to units from other users ()

In this case you can execute request core/search_items as described above  with parameters

params={"spec":{"itemsType":"avl_unit","propName":"sys_user_creator","propValueMask":"948","sortType":"sys_name","propType":"creatortree"},"force":1,"flags":1,"from":0,"to":200}}],"flags":0}

where  in "propValueMask" you need to specify user's ID for each user

You can execute all request using one request core/batch - please look exaple here https://sdk.wialon.com/wiki/en/sidebar/ … ples/batch

After you can data about units (the units data is set up due 'flags' - please look here more https://sdk.wialon.com/wiki/en/sidebar/ … ormat/unit ) you can constract reuired table on your app

Diana Cheley
Wialon Hosting Expert
Gurtam
11

Wialon Get Unit list API

Re: Wialon Get Unit list API

Thank you for explanation. However I do not understand this part:

chdi wrote:

All users have access only to own units

I am an admin of web.lematics.lt. I see all the users and their units when I open this site. Are you saying that it is not possible to extract via API a table with all the users and all their corresponding units?

12

Wialon Get Unit list API

Re: Wialon Get Unit list API

gvg wrote:

Thank you for explanation. However I do not understand this part:

chdi wrote:

All users have access only to own units

I am an admin of web.lematics.lt. I see all the users and their units when I open this site. Are you saying that it is not possible to extract via API a table with all the users and all their corresponding units?

Unfortunately, you cannot get a table in repsonse. You just get a list of items.  For example, list of units with access type  (valye "uacl" - current user access level for unit). All sorting (like on CMS site or on web.lematics.lt) is doing on our frontend part.

Diana Cheley
Wialon Hosting Expert
Gurtam
13

Wialon Get Unit list API

Re: Wialon Get Unit list API

OK, thanks a lot !