mediatype.get

Description描述

integer/array mediatype.get(object parameters)

The method allows to retrieve media types according to the given parameters.该方法允许根据给定的参数来检索媒体类型。

Parameters参数

(object) Parameters defining the desired output.(object)定义所需输出的参数。

The method supports the following parameters.该方法支持以下参数。

参数 类型 描述
mediatypeids string/array Return only media types with the given IDs. 只返回具有给定ID的媒体类型。
mediaids string/array Return only media types used by the given media.只返回给定媒体使用的媒体类型。
userids string/array Return only media types used by the given users.仅返回给定用户使用的媒体类型。
selectUsers query Return the users that use the media type in the users property.在“users”属性中返回使用媒体类型的用户。
sortfield string/array Sort the result by the given properties. 按照给定的属性对结果进行排序。Possible values are:可能的值: mediatypeid.
countOutput flagThese parameters being common for all get methods are described in detail in the reference commentary. 这些参数对于所有的“get”方法是常见的,在参考评论中有详细描述
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.如果已经使用“countOutput”参数,则检索到的对象的计数。

Examples 示例

Retrieving media types检索媒体类型

Retrieve all configured media types.检索所有配置的媒体类型。

Request:

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

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "mediatypeid": "1",
  6. "type": "0",
  7. "description": "Email",
  8. "smtp_server": "mail.company.com",
  9. "smtp_helo": "company.com",
  10. "smtp_email": "[email protected]",
  11. "exec_path": "",
  12. "gsm_modem": "",
  13. "username": "",
  14. "passwd": "",
  15. "status": "0"
  16. },
  17. {
  18. "mediatypeid": "2",
  19. "type": "3",
  20. "description": "Jabber",
  21. "smtp_server": "",
  22. "smtp_helo": "",
  23. "smtp_email": "",
  24. "exec_path": "",
  25. "gsm_modem": "",
  26. "username": "[email protected]",
  27. "passwd": "zabbix",
  28. "status": "0"
  29. },
  30. {
  31. "mediatypeid": "3",
  32. "type": "2",
  33. "description": "SMS",
  34. "smtp_server": "",
  35. "smtp_helo": "",
  36. "smtp_email": "",
  37. "exec_path": "",
  38. "gsm_modem": "/dev/ttyS0",
  39. "username": "",
  40. "passwd": "",
  41. "status": "0"
  42. }
  43. ],
  44. "id": 1
  45. }

See also参见

Source来源

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