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

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

[comment]: # ({0fba1140-821c3f80})
### 描述

`object map.update(object/array maps)`

This method allows to update existing maps.
此方法可以用来更新已存在的拓扑图

[comment]: # ({/0fba1140-821c3f80})

[comment]: # ({16324ecc-7a706637})
### Parameters 参数

`(object/array)` Map properties to be updated. `(object/array)`
更新拓扑图参数

The `mapid` property must be defined for each map, all other properties
are optional. Only the passed properties will be updated, all others
will remain unchanged.
`mapid`属性必须在每个拓扑图中定义，其他的属性是可选择的。只有传递的参数会被更新，其他的参数将会保持不变。

Additionally to the [standard map properties](object#map), the method
accepts the following parameters. 除了[standard map
properties](object#map),此方法还接受以下参数。

|Parameter|Type|Description|
|---------|----|-----------|
|links|array|Map links to replace the existing links. 拓扑图链接以替换现有的链接。|
|selements|array|Map elements to replace the existing elements. 拓扑图元素替换成已存在的拓扑图元素|
|urls|array|Map URLs to replace the existing URLs. 拓扑图URLs替换成已存在的URLs|
|users|array|Map user shares to replace the existing elements. 拓扑图的共享用户替换成已存在的共享用户|
|userGroups|array|Map user group shares to replace the existing elements. 拓扑图共享用户组替换成已存在的共享用户组|
|shapes|array|Map shapes to replace the existing shapes. 拓扑图图形替换成已存在的图形|
|lines|array|Map lines to replace the existing lines. 图谱图的连线替换成已存在的连线|

::: notetip
To create map links between new map elements you'll need
to set an elements `selementid` to an arbitrary value and then use this
value to reference this element in the links `selementid1` or
`selementid2` properties. When the element is created, this value will
be replaced with the correct ID generated by Zabbix. [See example for
map.create.](create#create_a_host_map)
::: <note
tip>要在新的拓扑图元素之间创建映射链接，您需要将一个元素设置为一个任意的值，然后使用这个值在链接`selemand1`或`selemand2`属性中引用这个元素。在创建元素时，将用Zabbix生成的正确ID替换该值。[See
example for map.create.](create#create_a_host_map)
:::

[comment]: # ({/16324ecc-7a706637})

[comment]: # ({b9e28f07-f1256f7a})
### Return values 返回值

`(object)` Returns an object containing the IDs of the updated maps
under the `sysmapids` property. `(object)`
返回一个对象，该对象包含“sysmapid”属性下更新的映射的id。

[comment]: # ({/b9e28f07-f1256f7a})

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

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

[comment]: # ({5324497b-6df0be65})
#### Resize a map 调整拓扑图的大小

Change the size of the map to 1200x1200 pixels.
改变拓扑图的大小为1200\*1200，单位是像素。

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "map.update",
    "params": {
        "sysmapid": "8",
        "width": 1200,
        "height": 1200
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "8"
        ]
    },
    "id": 1
}
```

[comment]: # ({/5324497b-6df0be65})

[comment]: # ({d150e20c-76eb7f1c})
#### Change map owner 改变拓扑图的属组

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

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "map.update",
    "params": {
        "sysmapid": "9",
        "userid": "1"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 2
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "sysmapids": [
            "9"
        ]
    },
    "id": 2
}
```

[comment]: # ({/d150e20c-76eb7f1c})

[comment]: # ({6c6205f1-6c6205f1})
### See also

-   [Map element](object#map_element)
-   [Map link](object#map_link)
-   [Map URL](object#map_url)
-   [Map user](object#map_user)
-   [Map user group](object#map_user_group)
-   [Map shapes](object#map_shapes)
-   [Map lines](object#map_lines)

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

[comment]: # ({63c22583-2f149f32})
### Source

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

[comment]: # ({/63c22583-2f149f32})
