Sidebar

zh:manual:api:reference:mediatype:create

mediatype.create

Description描述

object mediatype.create(object/array mediaTypes)

This method allows to create new media types.此方法允许创建新的媒体类型。

Parameters 参数

(object/array) Media types to create要创建的媒体类型。.

The method accepts media types with the standard media type properties.该方法接受具有标准媒介类型属性的媒介类型

Return values返回值

(object) Returns an object containing the IDs of the created media types under the mediatypeids property. The order of the returned IDs matches the order of the passed media types. 返回包含“mediatypeids”属性下创建的媒体类型的ID的对象。返回的ID的顺序与传递的媒体类型的顺序相匹配。

Examples示例

Creating a media type创建媒体类型

Create a new e-mail media type.创建一个新的电子邮件媒体类型

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:

{
    "jsonrpc": "2.0",
    "result": {
        "mediatypeids": [
            "7"
        ]
    },
    "id": 1
}

Source来源

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