template.massupdate

説明

object template.massupdate(object parameters)

このメソッドで、関連するオブジェクトを同時に置換または削除して複数のテンプレートのプロパティを更新できます。

このメソッドはAdminおよびSuper adminユーザータイプでのみ使用できます。 メソッドを呼び出す権限は、ユーザーロール設定で取り消すことができます。 詳細についてはユーザーの役割を参照してください。

パラメータ

(object) 更新するテンプレートの ID とテンプレートを置き換えるオブジェクトを含むパラメーター

このメソッドは、次のパラメーターを受け入れます

パラメータ タイプ 説明
templates
(必須)
object/array 更新するテンプレート。

テンプレートには templateid プロパティが定義されている必要があります。
groups object/array テンプレートが属する現在のホストグループを置換するホストグループ。

ホストグループにはgroupidプロパティが定義されている必要があります。
macros object/array 指定されたテンプレートの現在のユーザー マクロを置換するユーザー マクロ。
templates_clear object/array 指定されたテンプレートからリンクを解除してクリアするテンプレート。

テンプレートには templateid プロパティが定義されている必要があります。
templates_link object/array 現在リンクされているテンプレートを置き換えるテンプレート。

テンプレートには templateid プロパティが定義されている必要があります。

戻り値

(object) templateids プロパティの下で更新されたテンプレートの ID を含むオブジェクトを返します。

Unlinking a template

Unlink and clear template "10091" from the given templates.

Request:

{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085",
            "10086"
        ]
    },
    "id": 1
}

ホスト グループの置換

指定されたテンプレートからテンプレート"10091"のリンクを解除してクリアします。

Request:

{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085",
            "10086"
        ]
    },
    "id": 1
}

参照

ソース

CTemplate::massUpdate() in ui/include/classes/api/services/CTemplate.php.