Hello,
I have an issue to add new services via the API.
First, the API forces me to provide the field “ip”, If i leave it out, the API returns:
"status": "error", "message": "Service fields are missing: type, ip."
This behavior is different from the WebUI… but… ok…
Now if I provide an IP, my first request is working:
[librenms@libreserver ~]# curl --noproxy localhost -X POST -d ‘{“type”:“nrpe”,“ip”:“mailserver.mydomain”,“desc”:“DNS on dmz mailserver1”,“param”:“-c check_dns_mail1”}’ -H ‘X-Auth-Token: MYTOKEN’ http://localhost/api/v0/services/mailserver.mydomain
{
"status": "ok", "message": "Service nrpe has been added to device mailserver.mydomain (#268)"
}[librenms@libreserver ~]#
Now, if I want to add another one, it is failing again:
[librenms@libreserver ~]# curl --noproxy localhost -X POST -d ‘{“type”:“nrpe”,“ip”:“mailserver.mydomain”,“desc”:“DNS on dmz mailserver2,“param”:”-c check_dns_mail2"}’ -H ‘X-Auth-Token: MYTOKEN’ http://localhost/api/v0/services/mailserver.mydomain
{
"status": "error", "message": "Service fields are missing: type, ip."
}[librenms@libreserver ~]#
It is complaining about the missing “ip” field… though it is provided.
(providing the IP instead does not solve the issue…)
What am I doing wrong?
any help is appreciated. Thank you!