zorkian / nagios-api

A REST-like, JSON interface to Nagios
BSD 3-Clause "New" or "Revised" License
586 stars 173 forks source link

Spaces in hostnames #36

Open eldiddio opened 11 years ago

eldiddio commented 11 years ago

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

ghostsquad commented 10 years ago

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 commented 10 years ago

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 commented 9 years ago

@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