这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

获取

描述

integer/array templatescreenitem.get(object parameters)

此方法允许根据指定的参数检索聚合图形项模板。

参数

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

参数 类 描述
screenids string/array 仅返回指定所属聚合图形模板的聚合图形项模板ID。
screenitemids string/array 仅返回指定ID的聚合图形项模板。
hostids string/array 为每个聚合图形项模板返回一个额外的“real_resourceid”属性,该属性属于指定主机或模板的聚合图形。real_resourceid属性包含显示在聚合图形中的对象ID。
sortfield string/array 按给定属性对结果排序。

可能值:screenitemidscreenid
countOutput boolean 这些参数很常用,适用于所有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

返回值

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

  • 一组对象;
  • 若已使用了countOutput参数,则检索对象的计数。

示例

为聚合图形检索聚合图形项模板

从聚合图形模板"15"中返回所有聚合图形项模板。

请求:

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

响应:

{
           "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
       }

来源

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