1

Get all units in a unit group

(05/04/2019 21:56:04 отредактировано tuckerBA)

Тема: Get all units in a unit group

What is the best way to get all units in a unit group.

I see the array of ids returned with the group in "u", but I don't see how I can use that array to get the information about each unit except by searching units by id for each one. Ideally I wouldn't have to make multiple api calls to get this information, but I can't find anything in the docs that would say otherwise.

Does anyone know a good way to do this without having to make an api call per unit?

Thanks

EDIT: Mods can you delete this topic please? I found my answer in another post.  It might be worth updating the documentation though to show this option is possible.

This is the answer if this doesn't get closed an anyone else wants to know:
In propValueMask you can also specify ids separated by comma. Flags = 1025 it is 1 (base) + 0x400 (position & last message).
And that is on core/search_items

2

Get all units in a unit group

(09/04/2019 16:57:39 отредактировано Diana)

Re: Get all units in a unit group

Hello!

Thank you for your information.
As I understand you regarding proValueMask correctly the example is describe here Multicriteria search

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Get all units in a unit group

Re: Get all units in a unit group

I don't think what I'm talking about is the same in the example you linked, but I could be wrong. I'm talking about sending multiple unit ids in the propValueMask parameter. It seems like the multicriteria search would be used in searching by id and a string or something.

It also says

The number of criteria in “propName”, “propType” and “propValueMask” should be the same, because they are calculated by three, respectively

which isn't true of the request I'm making, since my propValueMask has 3 ids (in this example) and only 1 prop name.

An example of my request parameters is below, with the ids changed of course. This works to give me the details of the 3 units, which I got from the unit group.


spec: {
        itemsType: "avl_unit"
        propName: "sys_id"
        propValueMask: "1234,5678,9012"
        sortType: "sys_id"
    },
    force: 1, 
    flags: 17, 
    from: 0, 
    to: 0
4

Get all units in a unit group

Re: Get all units in a unit group

Hello!

The number of criteria in “propName”, “propType” and “propValueMask” should be the same, because they are calculated by three, respectively

It means if you use different criterias in searshing, for example you would like to found only accounts with names which start from 'Test' , so you specify 2 criteria in  “propName”:"rel_is_account,sys_name", 2 values in “propValueMask”:"1,Test*,  “propType” is optional parameter

Diana Cheley
Wialon Hosting Expert
Gurtam
5

Get all units in a unit group

Re: Get all units in a unit group

Right I understand that part, my point was that in the request I posted before, I don't match up the number of values in propName and propValueMask. You can see in propName I have 1 value ("sys_id") and in propValueMask I have 3 values ("1234,5678,9012"). That is what was unclear for me in the documentation.

6

Get all units in a unit group

Re: Get all units in a unit group

We'll change description in documentation to get more clear information.
Thank you for your notification.

Diana Cheley
Wialon Hosting Expert
Gurtam