获取

描述

integer/array mediatype.get(object parameters)

此方法用于检索给定参数和符合条件的媒介类型

参数

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

此方法支持一下参数。

Parameter Type Description
mediatypeids string/array 仅返回所给IDs的媒介类型。
mediaids string/array 只返回给定媒体使用的媒介类型。
userids string/array 只返回给定用户使用的媒介类型。
selectUsers query 返回users属性中使用媒介类型的用户。
sortfield string/array 根据给定的属性对结果进行排序。

可能的值是: mediatypeid
countOutput boolean 这些参数对于所有的“get”方法都是通用的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

Return values

(integer/array)返回如下:

  • 一个对象数组;
  • 如果使用了“countOutput”参数,则检索对象的计数。

示例如下

检索媒介类型

检索所有配置的媒介类型

Request:

{
    "jsonrpc": "2.0",
    "method": "mediatype.get",
    "params": {
        "output": "extend"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "mediatypeid": "1",
            "type": "0",
            "description": "Email",
            "smtp_server": "mail.company.com",
            "smtp_helo": "company.com",
            "smtp_email": "[email protected]",
            "exec_path": "",
            "gsm_modem": "",
            "username": "",
            "passwd": "",
            "status": "0",
            "maxsessions": "1",
            "maxattempts": "7",
            "attempt_interval": "10s"
        },
        {
            "mediatypeid": "2",
            "type": "3",
            "description": "Jabber",
            "smtp_server": "",
            "smtp_helo": "",
            "smtp_email": "",
            "exec_path": "",
            "gsm_modem": "",
            "username": "[email protected]",
            "passwd": "zabbix",
            "status": "0",
            "maxsessions": "1",
            "maxattempts": "7",
            "attempt_interval": "10s"
        },
        {
            "mediatypeid": "3",
            "type": "2",
            "description": "SMS",
            "smtp_server": "",
            "smtp_helo": "",
            "smtp_email": "",
            "exec_path": "",
            "gsm_modem": "/dev/ttyS0",
            "username": "",
            "passwd": "",
            "status": "0",
            "maxsessions": "1",
            "maxattempts": "7",
            "attempt_interval": "10s"
        }
    ],
    "id": 1
}

See also

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