1

Retrieve all the units positions and timestamps

(edited by adriangandelman 24/09/2019 21:08:17)

Topic: Retrieve all the units positions and timestamps

How can I retrieve all the units positions and timestamps using Wialon Hosting API? I do have a working username and password already.

This is the kind of format that I'm looking for. Link to documentation

https://i.imgur.com/YNldmV3.png

Is there some kind of "get all"? Otherwise just getting by any filter would be enough

2

Retrieve all the units positions and timestamps

Re: Retrieve all the units positions and timestamps

You can do core/search_items with following params:

{
    spec: {
        itemsType: 'avl_unit',
        propName: '',
        propValueMask: '',
        sortType: '',
        propType: '',
        or_logic: false,
    },
    force: 1,
    flags: 0x1 | 0x400,
    from: 0,
    to: 0,
}
3

Retrieve all the units positions and timestamps

Re: Retrieve all the units positions and timestamps

rual wrote:

You can do core/search_items with following params:

{
    spec: {
        itemsType: 'avl_unit',
        propName: '',
        propValueMask: '',
        sortType: '',
        propType: '',
        or_logic: false,
    },
    force: 1,
    flags: 0x1 | 0x400,
    from: 0,
    to: 0,
}

I'm getting the following error:

{
    "error": 4,
    "reason": "WRONG_PARAMS"
}

This is the URL just in case. I've hid the 'sid'.

http://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&sid=mysid&params={
    spec: {
        itemsType: 'avl_unit',
        propName: '',
        propValueMask: '',
        sortType: '',
        propType: '',
        or_logic: false,
    },
    force: 1,
    flags: 0x1 | 0x400,
    from: 0,
    to: 0,
}
4

Retrieve all the units positions and timestamps

Re: Retrieve all the units positions and timestamps

adriangandelman wrote:

This is the URL just in case.

Sorry, I provided javascript object.

You need to union flags and convert them to decimal: 0x1 | 0x400 = 1025, then serialize it to json:

{"spec":{"itemsType":"avl_unit","propName":"","propValueMask":"","sortType":"","propType":"","or_logic":false},"force":1,"flags":1025,"from":0,"to":0}

And encode uri component:

%7B%22spec%22%3A%7B%22itemsType%22%3A%22avl_unit%22%2C%22propName%22%3A%22%22%2C%22propValueMask%22%3A%22%22%2C%22sortType%22%3A%22%22%2C%22propType%22%3A%22%22%2C%22or_logic%22%3Afalse%7D%2C%22force%22%3A1%2C%22flags%22%3A1025%2C%22from%22%3A0%2C%22to%22%3A0%7D

So, correct url is:

http://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&sid=mysid&params=%7B%22spec%22%3A%7B%22itemsType%22%3A%22avl_unit%22%2C%22propName%22%3A%22%22%2C%22propValueMask%22%3A%22%22%2C%22sortType%22%3A%22%22%2C%22propType%22%3A%22%22%2C%22or_logic%22%3Afalse%7D%2C%22force%22%3A1%2C%22flags%22%3A1025%2C%22from%22%3A0%2C%22to%22%3A0%7D
5

Retrieve all the units positions and timestamps

Re: Retrieve all the units positions and timestamps

rual wrote:
adriangandelman wrote:

This is the URL just in case.

Sorry, I provided javascript object.

You need to union flags and convert them to decimal: 0x1 | 0x400 = 1025, then serialize it to json:

{"spec":{"itemsType":"avl_unit","propName":"","propValueMask":"","sortType":"","propType":"","or_logic":false},"force":1,"flags":1025,"from":0,"to":0}

And encode uri component:

%7B%22spec%22%3A%7B%22itemsType%22%3A%22avl_unit%22%2C%22propName%22%3A%22%22%2C%22propValueMask%22%3A%22%22%2C%22sortType%22%3A%22%22%2C%22propType%22%3A%22%22%2C%22or_logic%22%3Afalse%7D%2C%22force%22%3A1%2C%22flags%22%3A1025%2C%22from%22%3A0%2C%22to%22%3A0%7D

So, correct url is:

http://hst-api.wialon.com/wialon/ajax.html?svc=core/search_items&sid=mysid&params=%7B%22spec%22%3A%7B%22itemsType%22%3A%22avl_unit%22%2C%22propName%22%3A%22%22%2C%22propValueMask%22%3A%22%22%2C%22sortType%22%3A%22%22%2C%22propType%22%3A%22%22%2C%22or_logic%22%3Afalse%7D%2C%22force%22%3A1%2C%22flags%22%3A1025%2C%22from%22%3A0%2C%22to%22%3A0%7D

Thank you! that worked.

6

Retrieve all the units positions and timestamps

(edited by trushal.shah 22/09/2020 12:56:08)

Re: Retrieve all the units positions and timestamps

1)With the above APi how I cant get


The engine is ON or OFF
Car in the parking or running
Speed of the unit
Last update
Last physical address of the unit
name of the driver
svc=core/search_items&params={"spec":{"itemsType":"avl_unit","propName":"","propValueMask":"58415","sortType":"","propType":"creatortree"},"force":1,
"flags":4611686018427387903,"from":0,"to":1000}}],"flags":0}&sid=4d2ab565a7d0a1ee5fcdebe7c7bb1a63

2) How to apply filter by date to get units with all the above fields