Problem:
Under item.get calls, templateid returns the items's itemid of the template and not the templateid.
On the docs (https://www.zabbix.com/documentation/current/manual/api/reference/item/object):
| templateid | string | (readonly) ID of the parent template item. |
Hint: Use the hostid property to specify the template that the item belongs to.|
Proof of Concept:
1) item.get and randomly picking an item, I should have 10001 here on templateid of Linux template:
{
"itemid": "29167",
"name": "CPU interrupt time",
"templateid": "29130"
},
2) template.get using the itemids of templateid:
{
"output": ["name", "templateid", "hostid"],
"itemids": "29130",
"sortfield": "name"
}
3) And here is it, the hostid 10001 of Linux template:
{
"jsonrpc": "2.0",
"result": [
{
"itemid": "29130",
"name": "CPU interrupt time",
"templateid": "29093",
"hostid": "10001"
}
],
"id": 8
}