manual:api:reference:map:create

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
manual:api:reference:map:create [2016/09/28 07:26]
127.0.0.1 external edit
manual:api:reference:map:create [2019/01/28 14:50]
sasha <code js> => <code java>
Line 19: Line 19:
 | users | array | Map user shares to be created on the map. | | users | array | Map user shares to be created on the map. |
 | userGroups | array | Map user group shares to be created on the map. | | userGroups | array | Map user group shares to be created on the map. |
 +| shapes | array | Map shapes to be created on the map. |
 +| lines | array | Map lines to be created on the map. |
  
 <note tip>To create map links you'll need to set a map 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. [[create#​create_a_host_map|See example.]]</​note>​ <note tip>To create map links you'll need to set a map 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. [[create#​create_a_host_map|See example.]]</​note>​
Line 32: Line 34:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 47: Line 49:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 64: Line 66:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 74: Line 76:
         "​selements":​ [         "​selements":​ [
             {             {
-                "​elementid":​ "​1033",​ 
                 "​selementid":​ "​1",​                 "​selementid":​ "​1",​
 +                "​elements":​ [
 +                    {"​hostid":​ "​1033"​}
 +                ],
                 "​elementtype":​ 0,                 "​elementtype":​ 0,
                 "​iconid_off":​ "​2"​                 "​iconid_off":​ "​2"​
             },             },
 +
             {             {
-                "​elementid":​ "​1037",​ 
                 "​selementid":​ "​2",​                 "​selementid":​ "​2",​
 +                "​elements":​ [
 +                    {"​hostid":​ "​1037"​}
 +                ],
                 "​elementtype":​ 0,                 "​elementtype":​ 0,
                 "​iconid_off":​ "​2"​                 "​iconid_off":​ "​2"​
Line 99: Line 106:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 105: Line 112:
         "​sysmapids":​ [         "​sysmapids":​ [
             "​9"​             "​9"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +=== Create a trigger map ===
 +
 +Create a map with trigger element, which contains two triggers.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​map.create",​
 +    "​params":​ {
 +        "​name":​ "​Trigger map",
 +        "​width":​ 600,
 +        "​height":​ 600,
 +        "​selements":​ [
 +            {
 +                "​elements":​ [
 +                    {"​triggerid":​ "​12345"​},​
 +                    {"​triggerid":​ "​67890"​}
 +                ],
 +                "​elementtype":​ 2,
 +                "​iconid_off":​ "​2"​
 +            }
 +        ]
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​sysmapids":​ [
 +            "​10"​
         ]         ]
     },     },
Line 116: Line 165:
  
 Request: Request:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 143: Line 192:
  
 Response: Response:
-<​code ​js>+<​code ​java>
 { {
     "​jsonrpc":​ "​2.0",​     "​jsonrpc":​ "​2.0",​
Line 155: Line 204:
 </​code>​ </​code>​
  
 +=== Map shapes ===
 +
 +Create a map with map name title.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​map.create",​
 +    "​params":​ {
 +        "​name":​ "Host map",
 +        "​width":​ 600,
 +        "​height":​ 600,
 +        "​shapes":​ [
 +            {
 +                "​type":​ 0,
 +                "​x":​ 0,
 +                "​y":​ 0,
 +                "​width":​ 600,
 +                "​height":​ 11,
 +                "​text":​ "​{MAP.NAME}"​
 +            }
 +        ]
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​sysmapids":​ [
 +            "​10"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +=== Map lines ===
 +
 +Create a map line.
 +
 +Request:
 +<code java>
 +{
 +    "​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
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​sysmapids":​ [
 +            "​11"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
  
 ==== See also ==== ==== See also ====
Line 163: Line 296:
   * [[object#​map_user|Map user]]   * [[object#​map_user|Map user]]
   * [[object#​map_user_group|Map user group]]   * [[object#​map_user_group|Map user group]]
 +  * [[object#​map_shapes|Map shape]]
 +  * [[object#​map_lines|Map line]]
  
 ==== Source ==== ==== Source ====
  
 CMap::​create() in //​frontends/​php/​include/​classes/​api/​services/​CMap.php//​. CMap::​create() in //​frontends/​php/​include/​classes/​api/​services/​CMap.php//​.