Ad Widget

Collapse

API => map.createSelements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghyslain.detry
    Junior Member
    • Jun 2013
    • 1

    #1

    API => map.createSelements

    Hi,

    I try to add a host to a map with map.createSelements but it doesn't work.

    The JSON request is :

    Code:
    {
    							    "jsonrpc": "2.0",
    							    "method": "map.createSelements",
    							    "params": {
    							        "sysmapid" : "'+$HG1+'",
    									"elementid" : "'+$DG3hostid+'",
    									"elementtype" : 0,
    									"label" : "{HOST.NAME}",
    									"x" : 10,
    									"y" : 10,
    									"iconid_off" : "95",
    									"iconid_on" : "95",
    									"iconid_disabled" : "95",
    									"label_location" : 0
    							    },
    							    "auth": "'+$auth+'",
    							    "id": 1
    							}
    The JSON response is :

    Code:
    {"jsonrpc":"2.0","error":{"code":-32400,"message":"System error.","data":"JSON-rpc error generation failed. No such error \"\"."},"id":1}
    Can anyone tell me how this API method work?

    Zabbix version : 2.0.4

    Thank you!
  • Pavels
    Member
    • Oct 2011
    • 83

    #2
    CreateSelement is an internal method, not a public API method. Use map.create or map.update instead

    Comment

    • rmartineau
      Junior Member
      • Jan 2014
      • 8

      #3
      Hi,

      Why this method is only internal ?

      thanks

      Comment

      • Pavels
        Member
        • Oct 2011
        • 83

        #4
        Originally posted by rmartineau
        Hi,

        Why this method is only internal ?

        thanks
        Because everything it does can be done using map.create or map.update.

        Comment

        • rmartineau
          Junior Member
          • Jan 2014
          • 8

          #5
          Thanks for your prompt response Pavels.

          How can I add one element to an existing map without removing the other elements ?

          I have test it with map.update but this method replace all elements by the new element.

          I haven't found any real solution in the forum.

          My zabbix version is : 2.2.1

          Comment

          • Pavels
            Member
            • Oct 2011
            • 83

            #6
            You can't add an element. You'll need to retrieve all elements, add one on the client side and save all of them using map.update. That's the way the Zabbix API works in such cases.

            Comment

            • rmartineau
              Junior Member
              • Jan 2014
              • 8

              #7
              I had hope of a more faster solution but this one works so I use it.

              thanks a lot for your help

              Comment

              Working...