Issue with API, not able to add multiple services

Tags: #<Tag:0x00007f3b825f9fc8>

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:

[[email protected] ~]# 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)"

}[[email protected] ~]#

Now, if I want to add another one, it is failing again:

[[email protected] ~]# 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."

}[[email protected] ~]#

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!