object mediatype.create(object/array mediaTypes)
此方法允许创建新的媒介类型
(object/array)
创建媒介类型
该方法接受媒介类型关于 standard media type properties。
(object)
返回一个包含在“mediatypeids”属性下创建的媒体类型的ids的对象,返回id的顺序与传递的媒介类型的顺序匹配。
创建一个新的邮件媒介类型
Request:
{
"jsonrpc": "2.0",
"method": "mediatype.create",
"params": {
"description": "E-mail",
"type": 0,
"smtp_server": "[email protected]",
"smtp_helo": "company.com",
"smtp_email": "[email protected]"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
创建一个具有自定义值的新脚本媒体类型,用于尝试次数和尝试间隔。
Request:
{
"jsonrpc": "2.0",
"method": "mediatype.create",
"params": {
"type": 1,
"description": "Push notifications",
"exec_path": "push-notification.sh",
"exec_params": "{ALERT.SENDTO}\n{ALERT.SUBJECT}\n{ALERT.MESSAGE}\n",
"maxattempts": "5",
"attempt_interval": "11s"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CMediaType::create() in frontends/php/include/classes/api/services/CMediaType.php.
CMediaType::create() in ui/include/classes/api/services/CMediaType.php.