Description

    integer/array usermacro.get(object **parameters**)

    The method allows to retrieve host and global macros according to the given parameters.

    参数

    (object) 定义所需输出的参数。 该方法支持以下参数。

    (object) Parameters defining the desired output.

    The method supports the following parameters.

    ParameterTypeDescription
    globalmacroflagReturn global macros instead of host macros.
    globalmacroidsstring/arrayReturn only global macros with the given IDs.
    groupidsstring/arrayReturn only host macros that belong to hosts or templates from the given host groups.
    hostidsstring/arrayReturn only macros that belong to the given hosts or templates.
    hostmacroidsstring/arrayReturn only host macros with the given IDs.
    selectGroupsqueryReturn host groups that the host macro belongs to in the groups property.

    Used only when retrieving host macros.
    selectHostsqueryReturn hosts that the host macro belongs to in the hosts property.

    Used only when retrieving host macros.
    selectTemplatesqueryReturn templates that the host macro belongs to in the property.

    Used only when retrieving host macros.
    sortfieldstring/arraySort the result by the given properties.

    Possible value: macro.
    countOutputbooleanThese parameters being common for all get methods are described in detail in the page.
    editableboolean
    excludeSearchboolean
    filterobject
    limitinteger
    outputquery
    preservekeysboolean
    searchobject
    searchByAnyboolean
    searchWildcardsEnabledboolean
    sortorderstring/array
    startSearchboolean

    返回值

    (integer/array) 返回:

    • 如果已经使用“countOutput”参数,则检索到的对象的计数。

    Return values

    (integer/array) Returns either:

    • an array of objects;

    • the count of retrieved objects, if the parameter has been used.

    Examples

    检索主机的主机宏

    检索主机 “10198” 定义的所有主机宏。

    Retrieving host macros for a host

    Retrieve all host macros defined for host “10198”.

    Response:

    检索全局宏

    检索所有全局宏。

    Retrieving global macros

    Retrieve all global macros.

    Request:

    Response:

    来源

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