Sidebar

zh:manual:api:reference:templatescreenitem:get

获取

Description 说明

integer/array templatescreenitem.get(object parameters)

The method allows to retrieve template screen items according to the given parameters. 此方法允许根据指定的参数检索聚合图形项模板。

Parameters 参数

(object) Parameters defining the desired output. (object)定义所需输出的参数。 The method supports the following parameters. 该方法提供以下参数。

Parameter 参数 Type 类型 Description 说明
screenids string/array 字符串/数组 Return only template screen items that belong to the given template screens. 仅返回指定所属聚合图形模板的聚合图形项模板ID。
screenitemids string/array 字符串/数组 Return only template screen items with the given IDs. 仅返回指定ID的聚合图形项模板。
hostids string/array 字符串/数组 Returns an additional real_resourceid property for each template screen item, that belongs to a screen from the given hosts or templates. 为每个聚合图形项模板返回一个额外的“real_resourceid”属性,该属性属于指定主机或模板的聚合图形。 The real_resourceid property contains the ID of object displayed on the screen. real_resourceid属性包含在显示在聚合图形中的对象ID。
sortfield string/array 字符串/数组 Sort the result by the given properties. 以指定的属性对结果排序。

Possible values are: screenitemid and screenid. 许可值为:screenitemidscreenid
countOutput boolean 布尔值 These parameters being common for all get methods are described in detail in the reference commentary. 这些参数十分普遍,适用于所有get方法,详情参考reference commentary
editable boolean 布尔值
excludeSearch boolean 布尔值
filter object 对象
limit integer 整数型
output query 查询
preservekeys boolean 布尔值
search object 对象
searchByAny boolean 布尔值
searchWildcardsEnabled boolean 布尔值
sortorder string/array 字符串/数组
startSearch boolean 布尔值

Return values 返回值

(integer/array) Returns either: 返回两者其中任一:

  • an array of objects; 一组对象;
  • the count of retrieved objects, if the countOutput parameter has been used. 如果已经使用了countOutput参数,则检索对象的计数。

Examples 范例

Retrieve template screen items for screen 为聚合图形检索聚合图形项模板

Return all template screen items from template screen “15”. 从聚合图形模板“15”中返回所有聚合图形项模板。

Request 请求:

{
    "jsonrpc": "2.0",
    "method": "templatescreenitem.get",
    "params": {
        "output": "extend",
        "screenids": "15"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response 响应:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "screenitemid": "42",
            "screenid": "15",
            "resourcetype": "0",
            "resourceid": "454",
            "width": "500",
            "height": "200",
            "x": "0",
            "y": "0",
            "colspan": "1",
            "rowspan": "1",
            "elements": "0",
            "valign": "1",
            "halign": "0",
            "style": "0",
            "url": "",
            "max_columns": "3"
        },
        {
            "screenitemid": "43",
            "screenid": "15",
            "resourcetype": "0",
            "resourceid": "455",
            "width": "500",
            "height": "270",
            "x": "1",
            "y": "0",
            "colspan": "1",
            "rowspan": "1",
            "elements": "0",
            "valign": "1",
            "halign": "0",
            "style": "0",
            "url": "",
            "max_columns": "3"
        }
    ],
    "id": 1
}

Source 源码

CTemplateScreenItem::get() in frontends/php/include/classes/api/services/CTemplateScreenItem.php. CTemplateScreenItem::get()方法可在frontends/php/include/classes/api/services/CTemplateScreenItem.php中参考。