Jamf API to manage Departments with special characters in their name

scottwertz
New Contributor

I have a scheduled job in (unfortunately) PowerShell that updates user info from Jamf from their Active Directory records.  I have to create a Department in Jamf before I can assign it to a user, and that's working just fine unless the name of the department has characters in it that need to be encoded.  I've managed to work through that for the most part by converting an ampersand to & for example, but I can't for the life of me figure out how to get or create departments that have a forward slash in their name!

So if I have a department named THIS/THAT I'd use the url:

https://yourServer.jamfcloud.com/JSSResource/departments/name/THIS/THAT

But obviously the slash is a problem.  What do I replace it with?

2 REPLIES 2

PatrickD
Contributor II

Hi @scottwertz,

I haven't tested this but you maybe able to replace it with the UTF-8 code for the character. Check out the "URL Encoding Functions" section on this page https://www.w3schools.com/tags/ref_urlencode.ASP.

The UTF-8 code for / is %2F

Thanks for your reply, and sorry that I didn't include more about what I've already tried.  I've tried encoding the slash a few different ways: %2F, &sol, /, and /.  The %2F was what I naturally expected to work but it returns an HTTP Status 400 - Bad Request.  Others return a status page with "Not Found. The server has not found anything matching the request URI."