Description

    integer/array user.get(object **parameters**)

    The method allows to retrieve users according to the given parameters.

    Parameters

    (object) 定义所需输出的参数。

    该方法支持以下参数。

    (integer/array)返回:

    • 检索对象的计数, 如果 countOutput 参数被使用。

    Parameters

    (object) Parameters defining the desired output.

    The method supports the following parameters.

    ParameterTypeDescription
    mediaidsstring/arrayReturn only users that use the given media.
    mediatypeidsstring/arrayReturn only users that use the given media types.
    useridsstring/arrayReturn only users with the given IDs.
    usrgrpidsstring/arrayReturn only users that belong to the given user groups.
    getAccessflagAdds additional information about user permissions.

    Adds the following properties for each user:
    gui_access - (integer) user’s frontend authentication method. Refer to the gui_access property of the for a list of possible values.
    debug_mode - (integer) indicates whether debug is enabled for the user. Possible values: 0 - debug disabled, 1 - debug enabled.
    users_status - (integer) indicates whether the user is disabled. Possible values: 0 - user enabled, 1 - user disabled.
    selectMediasqueryReturn media used by the user in the medias property.
    selectMediatypesqueryReturn media types used by the user in the mediatypes property.
    selectUsrgrpsqueryReturn user groups that the user belongs to in the property.
    sortfieldstring/arraySort the result by the given properties.

    Possible values are: userid and alias.
    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;

    Examples

    检索用户

    Retrieving users

    检索所有已配置的用户。

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. "userid": "1",
    5. "alias": "Admin",
    6. "name": "Zabbix",
    7. "surname": "Administrator",
    8. "url": "",
    9. "autologin": "1",
    10. "autologout": "0s",
    11. "lang": "ru_RU",
    12. "refresh": "0s",
    13. "type": "3",
    14. "theme": "default",
    15. "attempt_failed": "0",
    16. "attempt_clock": "0",
    17. "rows_per_page": "50"
    18. },
    19. {
    20. "userid": "2",
    21. "alias": "guest",
    22. "surname": "User",
    23. "url": "",
    24. "autologin": "0",
    25. "autologout": "15m",
    26. "lang": "en_GB",
    27. "refresh": "30s",
    28. "type": "1",
    29. "theme": "default",
    30. "attempt_failed": "0",
    31. "attempt_ip": "",
    32. "attempt_clock": "0",
    33. "rows_per_page": "50"
    34. }
    35. ],
    36. }

    参考

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