Zabbix Documentation 1.8

2.23.03.4In development:4.0Unsupported versions:1.82.02.43.2

User Tools

Site Tools


Sidebar

api:item:create

Table of Contents

create()

This function allows you to create a item as defined by the item data array.

Parameters

Parameter Type OptionalDescriptionDetails
item dataarray or object Array of item objects or a single objectitemid shouldn't be specified

Returns

ParameterDescription
resultOperation successful. Result will contain array of created item IDs. itemid are assigned to each item object
error In case of any errors

Example

Create new item for host with host ID “100100000010048”

{
"jsonrpc":"2.0",
"method":"item.create",
"params":{
      "description": "Free disk space on $1",
      "key_": "vfs.fs.size[/home/aly/,free]",
      "hostid": "100100000010048",
      "applications": ["100100000000001", "100100000000002"]
},
"auth":"038e1d7b1735c6a5436ee9eae095879e",
"id":2
}

Item created successfully:

{
"jsonrpc":"2.0",
"result":{
   "itemids": ["100100000214797"]
},
"id":2
}

Item already exists:

{
"jsonrpc":"2.0",
"error":{
      "code":-32602,
      "message":"Invalid params.",
      "data":"[ CItem::create ] Cannot create Item"
},
"id":2
}