获取

Description 说明

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

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

Parameters 参数

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

Parameter 参数Type 类型Description 说明
hostidsstring/array 字符串/数组Return only template screens that belong to the given hosts. 仅返回指定主机所属的聚合图形模板。
screenidsstring/array 字符串/数组Return only template screens with the given IDs. 仅返回指定ID的聚合图形模板。
screenitemidsstring/array 字符串/数组Return only template screens that contain the given screen items. 仅返回包含指定聚合图形项的聚合图形模板。
templateidsstring/arary 字符串/数组Return only template screens that belong to the given templates. 仅返回指定模板所属的聚合图形模板。
noInheritanceflag 标记Do not return inherited template screens. 不返回继承的聚合图形模板。
selectScreenItemsquery 查询Return the screen items that are used in the template screen in the screenitems property. 返回screenitems属性中聚合图形模板使用的聚合图形项。
sortfieldstring/array 字符串/数组Sort the result by the given properties. 按指定的属性对结果分类。

Possible values are: screenid and name. 许可值为:screenidname
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 screens from template 从模板中检索聚合图形

Retrieve all screens from template “10001” and all of the screen items. 从模板“10001”中检索所有聚合图形以及检索所有聚合图形项。

Request 请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "templatescreen.get",
  4. "params": {
  5. "output": "extend",
  6. "selectScreenItems": "extend",
  7. "templateids": "10001"
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

Response 响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "screenid": "3",
  6. "name": "System performance",
  7. "hsize": "2",
  8. "vsize": "2",
  9. "templateid": "10001",
  10. "screenitems": [
  11. {
  12. "screenitemid": "20",
  13. "screenid": "3",
  14. "resourcetype": "0",
  15. "resourceid": "433",
  16. "width": "500",
  17. "height": "120",
  18. "x": "0",
  19. "y": "0",
  20. "colspan": "1",
  21. "rowspan": "1",
  22. "elements": "0",
  23. "valign": "1",
  24. "halign": "0",
  25. "style": "0",
  26. "url": ""
  27. },
  28. {
  29. "screenitemid": "21",
  30. "screenid": "3",
  31. "resourcetype": "0",
  32. "resourceid": "387",
  33. "width": "500",
  34. "height": "100",
  35. "x": "0",
  36. "y": "1",
  37. "colspan": "1",
  38. "rowspan": "1",
  39. "elements": "0",
  40. "valign": "1",
  41. "halign": "0",
  42. "style": "0",
  43. "url": ""
  44. },
  45. {
  46. "screenitemid": "22",
  47. "screenid": "3",
  48. "resourcetype": "1",
  49. "resourceid": "10013",
  50. "width": "500",
  51. "height": "148",
  52. "x": "1",
  53. "y": "0",
  54. "colspan": "1",
  55. "rowspan": "1",
  56. "elements": "0",
  57. "valign": "1",
  58. "halign": "0",
  59. "style": "0",
  60. "url": ""
  61. },
  62. {
  63. "screenitemid": "23",
  64. "screenid": "3",
  65. "resourcetype": "1",
  66. "resourceid": "22181",
  67. "width": "500",
  68. "height": "184",
  69. "x": "1",
  70. "y": "1",
  71. "colspan": "1",
  72. "rowspan": "1",
  73. "elements": "0",
  74. "valign": "1",
  75. "halign": "0",
  76. "style": "0",
  77. "url": ""
  78. }
  79. ]
  80. }
  81. ],
  82. "id": 1
  83. }

See also 参考

Source 源码

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