[comment]: # translation:outdated

[comment]: # ({df556223-df556223})
# map.update

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

[comment]: # ({77378e6b-77378e6b})
### Description

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

This method allows to update existing maps.

[comment]: # ({/77378e6b-77378e6b})

[comment]: # ({7a706637-7a706637})
### Parameters

`(object/array)` Map properties to be updated.

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.

Additionally to the [standard map properties](object#map), the method
accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|links|array|Map [links](/manual/api/reference/map/object#map_link) to replace the existing links.|
|selements|array|Map [elements](/manual/api/reference/map/object#map_element) to replace the existing elements.|
|urls|array|Map [URLs](/manual/api/reference/map/object#map_url) to replace the existing URLs.|
|users|array|Map [user](/manual/api/reference/map/object#map_user) shares to replace the existing elements.|
|userGroups|array|Map [user group](/manual/api/reference/map/object#map_user_group) shares to replace the existing elements.|
|shapes|array|Map [shapes](/manual/api/reference/map/object#map_shapes) to replace the existing shapes.|
|lines|array|Map [lines](/manual/api/reference/map/object#map_lines) to replace the existing lines.|

::: notetip
To create map links between new map elements you'll need
to set an element's `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)
:::

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

[comment]: # ({f1256f7a-f1256f7a})
### Return values

`(object)` Returns an object containing the IDs of the updated maps
under the `sysmapids` property.

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

[comment]: # ({b41637d2-b41637d2})
### Examples

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

[comment]: # ({6df0be65-6df0be65})
#### Resize a map

Change the size of the map to 1200x1200 pixels.

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]: # ({/6df0be65-6df0be65})

[comment]: # ({76eb7f1c-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]: # ({/76eb7f1c-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]: # ({2f149f32-2f149f32})
### Source

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

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