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:

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

    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:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "map.create",
    4. "params": {
    5. "name": "Host map",
    6. "width": 600,
    7. "height": 600,
    8. "selements": [
    9. {
    10. "selementid": "1",
    11. "elements": [
    12. {"hostid": "1033"}
    13. ],
    14. "elementtype": 0,
    15. "iconid_off": "2"
    16. },
    17. {
    18. "selementid": "2",
    19. "elements": [
    20. {"hostid": "1037"}
    21. ],
    22. "elementtype": 0,
    23. "iconid_off": "2"
    24. }
    25. ],
    26. "links": [
    27. {
    28. "selementid1": "1",
    29. }
    30. },
    31. "auth": "038e1d7b1735c6a5436ee9eae095879e",
    32. "id": 1
    33. }

    Response:

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

    Create a trigger map

    Create a map with trigger element, which contains two triggers.

    Request:

    Response:

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

    Map sharing

    Request:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "map.create",
    4. "params": {
    5. "name": "Map sharing",
    6. "width": 600,
    7. "height": 600,
    8. "users": [
    9. {
    10. "userid": "4",
    11. "permission": "3"
    12. }
    13. ],
    14. "userGroups": [
    15. {
    16. "usrgrpid": "7",
    17. "permission": "2"
    18. }
    19. ]
    20. },
    21. "auth": "038e1d7b1735c6a5436ee9eae095879e",
    22. "id": 1
    23. }

    Response:

    1. {
    2. "result": {
    3. "9"
    4. ]
    5. },
    6. "id": 1
    7. }

    Map shapes

    Create a map with map name title.

    Request:

    Response:

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

    Map lines

    Create a map line.

    Request:

    1. {
    2. "jsonrpc": "2.0",
    3. "method": "map.create",
    4. "params": {
    5. "name": "Map API lines",
    6. "width": 500,
    7. "height": 500,
    8. "lines": [
    9. {
    10. "x1": 30,
    11. "y1": 10,
    12. "x2": 100,
    13. "y2": 50,
    14. "line_type": 1,
    15. "line_width": 10,
    16. "line_color": "009900"
    17. }
    18. ]
    19. },
    20. "auth": "038e1d7b1735c6a5436ee9eae095879e",
    21. "id": 1
    22. }
    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "sysmapids": [
    5. "11"
    6. ]
    7. },
    8. "id": 1

    Source

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