map.create
This method allows to create new maps.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object/array)
Maps to create.
Additionally to the standard map properties, the method accepts the following parameters.
To create map links you’ll need to set a map element 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.
(object)
Returns an object containing the IDs of the created maps under the sysmapids
property. The order of the returned IDs matches the order of the passed maps.
Examples
Create an empty map
Create a map with no elements.
Response:
{
"jsonrpc": "2.0",
"result": {
"sysmapids": [
"8"
]
},
"id": 1
}
Create a host map
Create a map with two host elements and a link between them. Note the use of temporary “selementid1” and “selementid2” values in the map link object to refer to map elements.
Request:
{
"jsonrpc": "2.0",
"method": "map.create",
"params": {
"name": "Host map",
"width": 600,
"height": 600,
"selements": [
{
"selementid": "1",
"elements": [
{"hostid": "1033"}
],
"elementtype": 0,
"iconid_off": "2"
},
{
"selementid": "2",
"elements": [
{"hostid": "1037"}
],
"elementtype": 0,
"iconid_off": "2"
}
],
"links": [
{
"selementid1": "1",
}
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"sysmapids": [
"9"
]
},
"id": 1
}
Create a trigger map
Create a map with trigger element, which contains two triggers.
Request:
Response:
{
"jsonrpc": "2.0",
"result": {
"sysmapids": [
"10"
]
},
"id": 1
}
Map sharing
Request:
{
"jsonrpc": "2.0",
"method": "map.create",
"params": {
"name": "Map sharing",
"width": 600,
"height": 600,
"users": [
{
"userid": "4",
"permission": "3"
}
],
"userGroups": [
{
"usrgrpid": "7",
"permission": "2"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"result": {
"9"
]
},
"id": 1
}
Map shapes
Create a map with map name title.
Request:
Response:
{
"jsonrpc": "2.0",
"result": {
"sysmapids": [
"10"
]
},
"id": 1
}
Map lines
Create a map line.
Request:
{
"jsonrpc": "2.0",
"method": "map.create",
"params": {
"name": "Map API lines",
"width": 500,
"height": 500,
"lines": [
{
"x1": 30,
"y1": 10,
"x2": 100,
"y2": 50,
"line_type": 1,
"line_width": 10,
"line_color": "009900"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
{
"jsonrpc": "2.0",
"result": {
"sysmapids": [
"11"
]
},
"id": 1
Source
CMap::create() in ui/include/classes/api/services/CMap.php.