device.get

This method allows you to retrieve mobile devices for use with Zabbix mobile app.

The method is available to User, Admin, and Super admin users if EnableMobileDevices is enabled and the user has access to devices. Access to API methods can be revoked in user role configuration.

User and Admin users can only retrieve their own devices.

Method signature: integer/array device.get(object parameters)

Method source: CDevice::get() in ui/include/classes/api/services/CDevice.php

Parameters

Parameter Type Description
deviceids ID/array Return only devices with the given device IDs.
userids ID/array Return only devices belonging to users with the given user IDs.
roleids ID/array Return only devices belonging to users with the given user role IDs.
usrgrpids ID/array Return only devices belonging to users with the given user group IDs.
sortfield string/array Sort the result by the given properties.

Possible values: deviceid, name.
countOutput boolean These parameters are described in the reference commentary.
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Return values

Returns either an array of objects, or the count of retrieved objects (if countOutput is used).

Examples

Retrieve devices

Retrieve devices belonging to users with these user IDs: 1, 2, 3.
Note that user 2 (guest) has no devices, and device 3 has not yet been added or authenticated in Zabbix mobile app.

Request:

{
    "jsonrpc": "2.0",
    "method": "device.get",
    "params": {
        "output": "extend",
        "userids": [1, 2, 3]
    },
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "deviceid": "1",
            "userid": "1",
            "uuid": "019f930e-0ea2-7c1f-9dcc-0fbb60c40664",
            "name": "Google Pixel 10",
            "status": "1",
            "activated_at": "1784533122",
            "lastaccess": "1784879933"
        },
        {
            "deviceid": "2",
            "userid": "1",
            "uuid": "019d00fb-9e87-7ad5-bb4e-978467254aff",
            "name": "Apple iPhone 15 Pro",
            "status": "1",
            "activated_at": "1784533225",
            "lastaccess": "0"
        },
        {
            "deviceid": "3",
            "userid": "3",
            "uuid": "019d00fb-9e87-7ad5-bb4e-6ed88a2297ee",
            "name": "",
            "status": "0",
            "activated_at": "0",
            "lastaccess": "0"
        }
    ],
    "id": 1
}