[ZBX-7797] SQL ERROR IN API host.delete Created: 2014 Feb 12 Updated: 2017 May 30 Resolved: 2014 Feb 13 |
|
| Status: | Closed |
| Project: | ZABBIX BUGS AND ISSUES |
| Component/s: | API (A) |
| Affects Version/s: | 2.3.0 |
| Fix Version/s: | None |
| Type: | Incident report | Priority: | Trivial |
| Reporter: | Oleg Egorov (Inactive) | Assignee: | Unassigned |
| Resolution: | Won't fix | Votes: | 0 |
| Labels: | delete, host | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
{"jsonrpc":"2.0","method":"host.delete","id":2,"auth":"197f4ef47b6f1d6e1cea8147c4c28d21","params":{"hostid":"10100"}}
RETURN
{
"jsonrpc": "2.0",
"error": {
"code": -32500,
"message": "Application error.",
"data": "SQL statement execution has failed \"DELETE FROM screens_items WHERE resourceid=Array AND resourcetype='16'\""
},
"id": 2
}
|
| Comments |
| Comment by Oleg Egorov (Inactive) [ 2014 Feb 12 ] |
|
Same problem if parameter hostids not hostid |
| Comment by Pavels Jelisejevs (Inactive) [ 2014 Feb 13 ] |
|
This is because in 2.3 host.delete doesn't accept arrays of hosts, only arrays of host IDs. Yes, we must validate it, but that's a different ZBX. CLOSED. |
| Comment by Tiago Cruz [ 2015 Sep 18 ] |
|
I was very confused with the documentation, but this works with Zabbix Server 2.4
delete_item = ["10219"]
print zapi.host.delete(delete_item)
10: json_obj: {'params': [u'10219'], 'jsonrpc': '2.0', 'method': 'host.delete', 'auth': u'83cd40c9c93b6a1e37e54f090cb034e8', 'id': 2}
20: Sending: {"params": ["10219"], "jsonrpc": "2.0", "method": "host.delete", "auth": "83cd40c9c93b6a1e37e54f090cb034e8", "id": 2}
10: Sending headers: {'Content-Type': 'application/json-rpc', 'User-Agent': 'python/zabbix_api'}
20: Response Code: 200
10: Response Body: {u'jsonrpc': u'2.0', u'result': {u'hostids': [u'10219']}, u'id': 2}
|