nagios-api icon indicating copy to clipboard operation
nagios-api copied to clipboard

Spaces in hostnames

Open eldiddio opened this issue 11 years ago • 3 comments

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

eldiddio avatar Jun 20 '13 19:06 eldiddio

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.

ghostsquad avatar Jun 10 '14 14:06 ghostsquad

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.

ghostsquad avatar Aug 14 '14 21:08 ghostsquad

@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

ghostsquad avatar Apr 24 '15 21:04 ghostsquad