更新

Description 描述

object screen.update(object/array **screens**)

This method allows to update existing screens. 此方法允许更新已存在的聚合图形

Parameters 参数

(object/array) Screen properties to be updated. (object/array) 聚合图形参数将被更新

The screenid property must be defined for each screen, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 每个聚合图形必须定义screenid参数,其他参数是可以选择的。仅传递的参数会被更新,其他的的参数将保持不变。

Additionally to the standard screen properties, the method accepts the following parameters. 此外standard screen properties,此方法接受以下参数

ParameterTypeDescription
screenitemsarrayScreen items to replace existing screen items.

Screen items are updated by coordinates, so each screen item must have the x and y properties defined. 聚合图形项替换已存在的聚合图行项

聚合图形项通过坐标更新,所以每个聚合图形项必须拥定义x and y属性
usersarrayScreen user shares to replace the existing elements. 聚合图形用户共享替换已存在的元素
userGroupsarrayScreen user group shares to replace the existing elements. 聚合图形用户组共享替换已存在的元素

Return values 返回值

(object) Returns an object containing the IDs of the updated screens under the screenids property. (object) 返回一个对象,该对象包含screenids属性下更新聚合图形的id。

Examples 示例如下

Renaming a screen 重命名一个聚合图形

Rename a screen to “CPU Graphs”. 重命名一个聚合图形为“CPU Graphs”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "screen.update",
  4. "params": {
  5. "screenid": "26",
  6. "name": "CPU Graphs"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "screenids": [
  5. "26"
  6. ]
  7. },
  8. "id": 1
  9. }

Change screen owner 改变聚合图形属主

Available only for admins and super admins. 仅仅适用于管理员和超级管理员

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "screen.update",
  4. "params": {
  5. "screenid": "83",
  6. "userid": "1"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 2
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "screenids": [
  5. "83"
  6. ]
  7. },
  8. "id": 2
  9. }

See also

Source

CScreen::update() in frontends/php/include/classes/api/services/CScreen.php.