Hello,
is anyone has successfully queried the REST API v2 using curl and a JSON payload with a GET request?
I’m trying to get a list of hosts with a specific host template. I’m not sure it’s possible as host template doens’t seem to be a usable criteria for configuration/hosts endpoint.
Moreover, when I search for a specific host, the response is I must specify the address and the monitoring_server_id which differs from the documentation as I should search only by specifiying the name of the host (https://docs-api.centreon.com/api/centreon-web/24.04/#tag/Host/paths/~1configuration~1hosts/get)
My curl request:
curl -H “Content-Type: application/json” -H “X-AUTH-TOKEN: `cat token.txt`” “https://URL/centreon/api/latest/configuration/hosts?search” -d ‘{“name”:”hostname”}’
response : {"code":400,"message":"
and if I send the address & monitoring_server_id :
{"code":409,"message":"The name hostname (original name: hostname) already exists"}