Zabbix Documentation 1.8

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


api:host:massadd

Differences

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

Link to this comparison view

api:host:massadd [2014/09/26 11:26]
api:host:massadd [2014/09/25 14:40] (current)
sasha Page moved from 1.8:api:host:massadd to api:host:massadd
Line 1: Line 1:
 +===== massAdd() =====
 +Available since version: **1.8**\\
 +==== Parameters ====
 +multidimensional array with Hosts, Groups, Template, Macros data\\
  
 +Only host details can be added this way, not hosts themselves.
 +
 +^Parameter^Type^Optional^Description^Details^
 +|**hosts**|//​array//​| ​ |Host objects to update | |
 +|**groups**|//​array//​| Yes |Host group objects where hosts should be added. | |
 +|**templates**|//​array//​| Yes |Template objects which should be linked to hosts. | |
 +|**macros**|//​array//​| Yes |Macros objects which should be added to hosts. ​ | |
 +
 +==== Returns =====
 +^Parameter^Description^
 +|**result**|Operation successful. Result will contain array of updated Host IDs.|
 +|**error**|In case of any errors|
 +==== Example ====
 +
 +Add two macros to host with **ID** "​100100000010092"​
 +<​code>​
 +{
 +"​jsonrpc":"​2.0",​
 +"​method":"​host.massAdd",​
 +"​params":​{ ​
 +"​hosts": ​
 + {
 +  "​hostid":​ "​100100000010092"​
 + },
 +"​macros":​ [
 +  {
 +    "​macro":​ "​{$TEST1}",​
 +    "​value":​ "​MACROTEST1"​
 +  },
 +  {
 +    "​macro":​ "​{$TEST2}",​
 +    "​value":​ "​MACROTEST2"​
 +  }
 +]
 +},
 +"​auth":"​f223adf833b2bf2ff38574a67bba6372",​
 +"​id":​2
 +}
 +</​code>​
 +Hosts updated successfully:​
 +
 +<​code>​
 +{
 +"​jsonrpc":"​2.0",​
 +"​result":​{
 +   "​hostids":​["​100100000010092"​]
 +},
 +"​id":​2
 +}
 +</​code>​