You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

usergroup.get

Description

integer/array usergroup.get(object parameters)

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

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
mfaids ID/array Return only user groups with the given MFA methods.
mfa_status integer Return only user groups with the given MFA status.

Refer to the user group page for a list of supported statuses.
status integer Return only user groups with the given status.

Refer to the user group page for a list of supported statuses.
userids ID/array Return only user groups that contain the given users.
usrgrpids ID/array Return only user groups with the given IDs.
selectTagFilters query Return user group tag-based permissions in the tag_filters property.
selectUsers query Return the users from the user group in the users property.
selectHostGroupRights query Return user group host group permissions in the hostgroup_rights property.

Refer to the user group page for a list of access levels to host groups.
selectTemplateGroupRights query Return user group template group permissions in the templategroup_rights property.

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

Possible values: usrgrpid, name.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean
selectRights
(deprecated)
query This parameter is deprecated, please use selectHostGroupRights or selectTemplateGroupRights instead.
Return user group rights in the rights property.
Refer to the user group page for a list of access levels to host groups.

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
           },
           "id": 1
       }

Response:

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

See also

Source

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