Zabbix Documentation 3.0

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


Sidebar

manual:api:reference:usergroup:get

usergroup.get

Description

integer/array usergroup.get(object parameters)

The method allows to retrieve user groups according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
status integer Return only user groups with the given status.

Refer to the user group page for a list of supported statuses.
userids string/array Return only user groups that contain the given users.
usrgrpids string/array Return only user groups with the given IDs.
with_gui_access integer Return only user groups with the given frontend authentication method.

Refer to the user group page for a list of supported methods.
selectUsers query Return the users from the user group in the users property.
selectRights query Return user group rights in the rights property.

It has the following properties:
permission - (integer) access level to the host group;
id - (string) ID of the host group.

Refer to the user group page for a list of access levels to host groups.
limitSelects integer Limits the number of records returned by subselects.
sortfield string/array Sort the result by the given properties.

Possible values are: usrgrpid, name.
countOutput flagThese parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch flag
filter object
limit integer
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving enabled user groups

Retrieve all enabled user groups.

Request:

{
    "jsonrpc": "2.0",
    "method": "usergroup.get",
    "params": {
        "output": "extend",
        "status": 0
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "usrgrpid": "7",
            "name": "Zabbix administrators",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "1"
        },
        {
            "usrgrpid": "8",
            "name": "Guests",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0"
        },
        {
            "usrgrpid": "11",
            "name": "Enabled debug mode",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "1"
        },
        {
            "usrgrpid": "12",
            "name": "No access to the frontend",
            "gui_access": "2",
            "users_status": "0",
            "debug_mode": "0"
        },
        {
            "usrgrpid": "14",
            "name": "Read only",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0"
        },
        {
            "usrgrpid": "18",
            "name": "Deny",
            "gui_access": "0",
            "users_status": "0",
            "debug_mode": "0"
        }
    ],
    "id": 1
}

See also

Source

CUserGroup::get() in frontends/php/include/classes/api/services/CUserGroup.php.