API with / in object name

luke_reagor
Contributor II

When using the API to get class info, no results are returned (error or otherwise) when the name of the class contains a forward slash ( / ).

Here's a class named 'S/C Test'.
This API call returns nothing. No error, no results.... nothing.

curl -s -u user:pass https://jss.example.com:8443/JSSResource/classes/name/S%2fC%20Test

If I put an invalid class name, I get an error message. So I know it's not having an error due to not reading the forward slash. It appears to just not give anything back.

Any thoughts on how to get results in this case. And for those saying to just use the ID, I'm doing this call to get the ID.

1 REPLY 1

NoahRJ
Contributor II

I can confirm I'm seeing the same thing with my JSS on 9.96. Entering in the policy ID on the API Resource Documentation page returns fine, but when I enter the policy name that has a forward slash, it won't return a result. Just spins its wheels on "Searching".

Interestingly enough, if I punch in a different policy name and get results there, and then enter my policy name with a slash, the request URL updates properly with what the address should be, complete with the %2F for the forward slash, but the XML response body never updates and navigating to the provided URL returns blank.

I don't know if this is a broader issue with how RESTful APIs handle forward slashes when returning values, or if this is a JSS-specific bug, but I'm definitely seeing the same problem as you.