1

Fetch list of disabled users

(26/10/2023 14:29:08 отредактировано omriregev)

Тема: Fetch list of disabled users

Hi,
I'm trying to fetch a list of disabled users through the API (Users belonging to a disabled account), but I always receive an empty list.
Here is the request:

svc=core/search_items&params={
    "spec": {
        "itemsType": "user",
        "propName": "sys_account_disabled",
        "propValueMask": "1",
        "sortType": "sys_account_disabled"
    },
    "force": 1,
    "flags": 1,
    "from": 0,
    "to": 0
}

Whether I send propValueMask:"0" or "1", I always get no items back:

{
    "searchSpec": {
        "itemsType": "user",
        "propName": "sys_account_disabled",
        "propValueMask": "1",
        "sortType": "sys_account_disabled",
        "propType": "",
        "or_logic": "0"
    },
    "dataFlags": 1,
    "totalItemsCount": 0,
    "indexFrom": 0,
    "indexTo": 0,
    "items": []
}

When calling the following request I do get a list of users (Hence there's no permissions issue with fetching users):

svc=core/search_items&params={
    "spec": {
        "itemsType": "user",
        "propName": "sys_name",
        "propValueMask": "*",
        "sortType": "sys_name"
    },
    "force": 1,
    "flags": 1,
    "from": 0,
    "to": 0
}

Any thoughts on what I'm doing wrong?

2

Fetch list of disabled users

Re: Fetch list of disabled users

omriregev hello, the issue related to this part - "propName": "sys_account_disabled"
sys_account_disabled property can be applied for avl_resource items type only, it can't be set for the users or other items.
If you set itemsType to avl_resource and with sys_account_disabled propName with propValueMask 1, you will get all blocked accounts.

In order to determined whether the user is disabled, you can use search by users with other propName, like sys_name and flags value 257. Thus you will get "fl" parameter. It contains user's flags value. Thus value may content flag value related to the user status.
More information n about flags value you can find here -- https://sdk.wialon.com/wiki/en/sidebar/ … user_flags

Anton Zinovyev
Technical Care Engineer (L2)
Wialon