此方法允许创建新的主机宏。

    Description

    object usermacro.create(object/array **hostMacros**)

    This method allows to create new host macros.

    (object/array)要创建的主机宏。

    Parameters

    (object/array) Host macros to create.

    The method accepts host macros with the .

    (object) 返回包含“hostMacroids”属性下创建的主机宏的ID的对象。 返回的ID的顺序与传递的主机宏的顺序相匹配。

    Return values

    Returns an object containing the IDs of the created host macros under the hostmacroids property. The order of the returned IDs matches the order of the passed host macros.

    创建主机宏

    Creating a host macro

    Creat a host macro “{$SNMP_COMMUNITY}” with the value “public” on host “10198”.

    Request:

    Response:

    1. {
    2. "result": {
    3. "11"
    4. ]
    5. },

    来源

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