nagios-api
nagios-api copied to clipboard
Spaces in hostnames
When I call the API like this:
/host/Test_Server_1 the API responds fine.
however if I try this:
/host/Test Server 1
The API responds with {"content": "Invalid request URI", "success": false}
Can you please advise how i can get details of hostnames with spaces in the name?
Thanks
I don't believe spaces are valid characters for hostnames. However, the URL encoding for "space" is %20. So, you may want to try /host/Test%20Server%201.
Now that I'm using this api myself, I understand the reason for this issue. The nagios object name for a host may not be the actual hostname of the server, and as such, spaces are permitted. Even with url encoding, it comes back is an invalid request.
@MaxBear - your commit won't work, because "spaces" aren't actually allow in a URL, a urlencoded name that includes spaces: before: test server
would be test+server
or test%20server
. I've fixed that in ghostsquad/nagios-api@ef52c90