[comment]: # ({3ab1bd41-5102e8bb})
# 更新

[comment]: # ({/3ab1bd41-5102e8bb})

[comment]: # ({bd30867e-ff6dac41})
### Description 描述

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

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

[comment]: # ({/bd30867e-ff6dac41})

[comment]: # ({bec9d89b-6da273d1})
### 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](object#screen), the
method accepts the following parameters. 此外[standard screen
properties](object#screen),此方法接受以下参数

|Parameter|Type|Description|
|---------|----|-----------|
|screenitems|array|Screen items to replace existing screen items.<br><br>Screen items are updated by coordinates, so each screen item must have the `x` and `y` properties defined. 聚合图形项替换已存在的聚合图行项<br><br>聚合图形项通过坐标更新，所以每个聚合图形项必须拥定义`x` and `y`属性|
|users|array|Screen user shares to replace the existing elements. 聚合图形用户共享替换已存在的元素|
|userGroups|array|Screen user group shares to replace the existing elements. 聚合图形用户组共享替换已存在的元素|

[comment]: # ({/bec9d89b-6da273d1})

[comment]: # ({81cba47e-a7d28486})
### Return values 返回值

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

[comment]: # ({/81cba47e-a7d28486})

[comment]: # ({7b785443-b41637d2})
### Examples 示例如下

[comment]: # ({/7b785443-b41637d2})

[comment]: # ({77c212c6-136c04cc})
#### Renaming a screen 重命名一个聚合图形

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

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "screen.update",
    "params": {
        "screenid": "26",
        "name": "CPU Graphs"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "screenids": [
            "26"
        ]
    },
    "id": 1
}
```

[comment]: # ({/77c212c6-136c04cc})

[comment]: # ({b76052f4-770bf5d2})
#### Change screen owner 改变聚合图形属主

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

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "screen.update",
    "params": {
        "screenid": "83",
        "userid": "1"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 2
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "screenids": [
            "83"
        ]
    },
    "id": 2
}
```

[comment]: # ({/b76052f4-770bf5d2})

[comment]: # ({60031f32-60031f32})
### See also

-   [Screen item](/manual/api/reference/screenitem/object#screen_item)
-   [screenitem.create](/manual/api/reference/screenitem/create)
-   [screenitem.update](/manual/api/reference/screenitem/update)
-   [screenitem.updatebyposition](/manual/api/reference/screenitem/updatebyposition)
-   [Screen user](object#screen_user)
-   [Screen user group](object#screen_user_group)

[comment]: # ({/60031f32-60031f32})

[comment]: # ({c7ef95ff-c7ef95ff})
### Source

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

[comment]: # ({/c7ef95ff-c7ef95ff})
