获取

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 说明
screenidsstring/array 字符串/数组Return only template screen items that belong to the given template screens. 仅返回指定所属聚合图形模板的聚合图形项模板ID。
screenitemidsstring/array 字符串/数组Return only template screen items with the given IDs. 仅返回指定ID的聚合图形项模板。
hostidsstring/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。
sortfieldstring/array 字符串/数组Sort the result by the given properties. 以指定的属性对结果排序。

Possible values are: screenitemid and screenid. 许可值为:screenitemidscreenid
countOutputboolean 布尔值These parameters being common for all get methods are described in detail in the reference commentary. 这些参数十分普遍,适用于所有get方法,详情参考reference commentary
editableboolean 布尔值
excludeSearchboolean 布尔值
filterobject 对象
limitinteger 整数型
outputquery 查询
preservekeysboolean 布尔值
searchobject 对象
searchByAnyboolean 布尔值
searchWildcardsEnabledboolean 布尔值
sortorderstring/array 字符串/数组
startSearchboolean 布尔值

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 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "templatescreenitem.get",
  4. "params": {
  5. "output": "extend",
  6. "screenids": "15"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "screenitemid": "42",
  6. "screenid": "15",
  7. "resourcetype": "0",
  8. "resourceid": "454",
  9. "width": "500",
  10. "height": "200",
  11. "x": "0",
  12. "y": "0",
  13. "colspan": "1",
  14. "rowspan": "1",
  15. "elements": "0",
  16. "valign": "1",
  17. "halign": "0",
  18. "style": "0",
  19. "url": "",
  20. "max_columns": "3"
  21. },
  22. {
  23. "screenitemid": "43",
  24. "screenid": "15",
  25. "resourcetype": "0",
  26. "resourceid": "455",
  27. "width": "500",
  28. "height": "270",
  29. "x": "1",
  30. "y": "0",
  31. "colspan": "1",
  32. "rowspan": "1",
  33. "elements": "0",
  34. "valign": "1",
  35. "halign": "0",
  36. "style": "0",
  37. "url": "",
  38. "max_columns": "3"
  39. }
  40. ],
  41. "id": 1
  42. }

Source 源码

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