获取

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. 此方法支持一下参数。

ParameterTypeDescription
mediatypeidsstring/arrayReturn only media types with the given IDs. 仅返回所给IDs的媒介类型
mediaidsstring/arrayReturn only media types used by the given media. 只返回给定媒体使用的媒介类型。
useridsstring/arrayReturn only media types used by the given users. 只返回给定用户使用的媒介类型。
selectUsersqueryReturn the users that use the media type in the users property. 返回users属性中使用媒介类型的用户。
sortfieldstring/arraySort the result by the given properties.

Possible values are: mediatypeid. 根据给定的属性对结果进行排序。

可能的值是: mediatypeid
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary. 这些参数对于所有的“get”方法都是通用的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.

  • 一个对象数组;

  • 如果使用了“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. "maxsessions": "1",
  17. "maxattempts": "7",
  18. "attempt_interval": "10s"
  19. },
  20. {
  21. "mediatypeid": "2",
  22. "type": "3",
  23. "description": "Jabber",
  24. "smtp_server": "",
  25. "smtp_helo": "",
  26. "smtp_email": "",
  27. "exec_path": "",
  28. "gsm_modem": "",
  29. "username": "[email protected]",
  30. "passwd": "zabbix",
  31. "status": "0",
  32. "maxsessions": "1",
  33. "maxattempts": "7",
  34. "attempt_interval": "10s"
  35. },
  36. {
  37. "mediatypeid": "3",
  38. "type": "2",
  39. "description": "SMS",
  40. "smtp_server": "",
  41. "smtp_helo": "",
  42. "smtp_email": "",
  43. "exec_path": "",
  44. "gsm_modem": "/dev/ttyS0",
  45. "username": "",
  46. "passwd": "",
  47. "status": "0",
  48. "maxsessions": "1",
  49. "maxattempts": "7",
  50. "attempt_interval": "10s"
  51. }
  52. ],
  53. "id": 1
  54. }

See also

Source

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