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.

ParameterTypeDescription
statusintegerReturn only user groups with the given status.

Refer to the user group page for a list of supported statuses.
useridsstring/arrayReturn only user groups that contain the given users.
usrgrpidsstring/arrayReturn only user groups with the given IDs.
with_gui_accessintegerReturn only user groups with the given frontend authentication method.

Refer to the user group page for a list of supported methods.
selectTagFiltersqueryReturn user group tag based permissions in the tag_filters property.

It has the following properties:
groupid - (string) ID of the host group;
tag - (string) tag name;
value - (string) tag value.
selectUsersqueryReturn the users from the user group in the users property.
selectRightsqueryReturn 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.
limitSelectsintegerLimits the number of records returned by subselects.
sortfieldstring/arraySort the result by the given properties.

Possible values are: usrgrpid, name.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "usergroup.get",
  4. "params": {
  5. "output": "extend",
  6. "status": 0
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "usrgrpid": "7",
  6. "name": "Zabbix administrators",
  7. "gui_access": "0",
  8. "users_status": "0",
  9. "debug_mode": "1"
  10. },
  11. {
  12. "usrgrpid": "8",
  13. "name": "Guests",
  14. "gui_access": "0",
  15. "users_status": "0",
  16. "debug_mode": "0"
  17. },
  18. {
  19. "usrgrpid": "11",
  20. "name": "Enabled debug mode",
  21. "gui_access": "0",
  22. "users_status": "0",
  23. "debug_mode": "1"
  24. },
  25. {
  26. "usrgrpid": "12",
  27. "name": "No access to the frontend",
  28. "gui_access": "2",
  29. "users_status": "0",
  30. "debug_mode": "0"
  31. },
  32. {
  33. "usrgrpid": "14",
  34. "name": "Read only",
  35. "gui_access": "0",
  36. "users_status": "0",
  37. "debug_mode": "0"
  38. },
  39. {
  40. "usrgrpid": "18",
  41. "name": "Deny",
  42. "gui_access": "0",
  43. "users_status": "0",
  44. "debug_mode": "0"
  45. }
  46. ],
  47. "id": 1
  48. }

See also

Source

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