Ad Widget

Collapse

Updating inventory through API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iverona
    Junior Member
    • May 2013
    • 7

    #1

    Updating inventory through API

    Hi all,

    I'm trying to update an inventory field through the API but it is not working. For host fields it's OK, but don't know what's wrong with the inventory JSON petition:

    Code:
    {
       "jsonrpc":"2.0",
       "method":"host.update",
       "params":{
          "hostid":"10119",
          "inventory":[
             {
                "software":"version5"
             }
          ]
       },
       "auth":"feb34b1ec5e7de058f9d5388e02dd045",
       "id":1
    }
    Answer:

    Code:
    {
       "jsonrpc":"2.0",
       "result":{
          "hostids":[
             "10119"
          ]
       },
       "id":1
    }
    Any hints about where's the problem?

    Thanks in advance!
  • iverona
    Junior Member
    • May 2013
    • 7

    #2
    Solved,

    I had a typo on the inventory object. Now it's working:

    Code:
    {
       "params":{
          "hostid":"10119",
          "inventory":{
             "software":"version5"
          }
       },
       "jsonrpc":"2.0",
       "method":"host.update",
       "auth":"1f3ab0cfb5a9944e40833c7772f88907",
       "id":1
    }

    Comment

    Working...