Ad Widget

Collapse

api request

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • checifaccioqua?
    Junior Member
    • Mar 2011
    • 14

    #1

    api request

    HI,
    When I send the login request with zabbix's api is all ok.
    Code:
    {"jsonrpc":"2.0","result":"e62c084cbcd07e8ff5fc071b3b1c06e7","id":"Math.random()"}
    I take the "result" and i use this for api request. This is my question.....Why when i insert "apiinfo.version" it's ok
    Code:
     {"jsonrpc":"2.0","result":"1.3","id":"Math.random()"}
    while when i insert agent.ping he answer me
    Code:
    {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Not authorized"},"id":"Math.random()"}
    ?

    thanks....
    Last edited by checifaccioqua?; 10-03-2011, 12:47.
  • checifaccioqua?
    Junior Member
    • Mar 2011
    • 14

    #2
    ok, change my question......how I write the json request for get my item?? My item's name is sim3.ping and he answer me with a float number.....please It's urgent.....thanks

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      Does the user account you are using for the api requests have read permission to the host group associated with your item?
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      • checifaccioqua?
        Junior Member
        • Mar 2011
        • 14

        #4
        Yes it's a super user. Now my problem is use item.get() for call my item....his name is sim3.ping and he answer me with a float number....thanks...

        Comment

        • Aly
          ZABBIX developer
          • May 2007
          • 1126

          #5
          You don't provide authentication string in your request. For ex:
          http://www.zabbix.com/documentation/1.8/api/item/get
          Code:
          {
          "jsonrpc":"2.0",
          "method":"item.get",
          "params":{
              "output":"shorten",
              "search": {"description": "apache"},
              "limit": 10
          },
          "auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
          "id":2
          }
          Zabbix | ex GUI developer

          Comment

          • checifaccioqua?
            Junior Member
            • Mar 2011
            • 14

            #6
            Request of Item

            Hi I've resolved my problem and all play well. I want to know what to put in the request for me to return JSON-RPC response as the object id. What should I send the request?
            thanks a lot.....

            Comment

            Working...