This happens also with other methods but this example will be about host.create.
Trying to create a host with host interface identified by IP. Still I am forced to set an empty DNS value: "dns":"" and if I don't I get obscure error message: Incorrect arguments passed to function.
The fact that a user sends JSON and gets error message about incorrect function usage is really annoying and the error message is not helpful at all.
Steps to reproduce:
Send JSON to create a host without specifying empty "dns" param:
{"jsonrpc":"2.0","method":"host.create","params":{"host":"test host","interfaces":[{"type":1,"main":1,"useip":1,"ip":"127.0.0.1","port":"10050"}],"groups":[{"groupid":"4"}]},"auth":"a21705c51026778eafc68494b52bd9a0","id":1}
Result:
Check the error in returned JSON:
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Incorrect arguments passed to function."},"id":1}
Expected:
Error message telling the real problem is missing param: "dns".
It would be great also not to force user to set empty parameters.
- duplicates
-
ZBX-7819 Importing XML template has strange behavior when there are comments
- Closed
-
ZBXNEXT-6998 Implement audit for API host
- READY TO DEVELOP
- part of
-
ZBX-3783 Proper API validation
- Reopened