Ad Widget

Collapse

template clear by API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samarit
    Junior Member
    • Jul 2011
    • 6

    #1

    template clear by API

    Is it possible to unlink and clear template from host through API request? (like button "Unlink and clear" in host configuration)
    I found option "templates_clear" for "method":"template.update" and example with this option, but it's don't work for me: new template was linked to host, but old template was not unlink and not cleared.
    Code:
    "jsonrpc":"2.0",
    "method":"template.update",
    "params":{
    "templateid": "10159",
    "hosts": [ {"hostid": "10158"} ],
    "templates_clear": [{"templateid": "10157"}]
  • mcmyst
    Member
    • Feb 2012
    • 72

    #2
    Quite old post but the only one that I have found about this subject.

    I am trying to unlink and clear a template from a host, with this request:
    Code:
    "params": {
        "templates_clear": [{"templateid": "34302"}],
        "hosts": [{"hostid": "34297"}],
        "templateid": "34302"
    }
    But this is not working : no errors, but the template is still linked to the host.
    I am working with zabbix 1.8.12.

    EDIT:
    I have also tried this :
    Code:
    params": {
        "hosts": [{"hostid": "34297"}], 
        "templates_clear": [{"templateid": "34302"}]
    }
    But I am getting an error...
    Last edited by mcmyst; 31-05-2012, 10:04.

    Comment

    • mcmyst
      Member
      • Feb 2012
      • 72

      #3
      I have found the solution, I have to use host.update method like that:
      Code:
      "params": {
          "hostid": "34297", 
          "templates_clear": [{"templateid": "34302"}]
      }

      Comment

      Working...