Remove a site from a user with API

fdeltesta
Contributor

Hi,

I'm trying to update a user's site using the Jamf Pro API, though I can't find anything on this in the documentation.

I managed to successfully overwrite the list with another one, or a single site. Though I don't know what I can do tu specifically remove one site.

 

If I could avoid filtering the current list in XML to remove the said site from the string and then re-push it, that'll be great. Because this solution seems.. Barbaric.

2 REPLIES 2

Dharmateja_A
New Contributor II

Hi @fdeltesta 

Just update the computer record with "None", if you dont want to attach the computer to any site. 

curl -sku  username:password -H "content-type: text/xml"  url/JSSResource/computers/id/24   -X PUT -d "<computer><general><site><name>None</name></site></general></computer>"

 

 

fdeltesta
Contributor

@Dharmateja_Athank you for your reply,

Though I'm not talking about the computer inventory, but the actual sites attached to a users profile in the database.

I plan on moving to a more user-based management since we're now able to use our AD departments in Jamf [...]

Thus It bothers me that whenever you link a computer to a user, it automatically put the user into a site, BUT if you unnassign the computer from the user, the user still have the site assigned to him. Which in here is problematic.

Though I could use your provided solution and adapt it to the users profile but it'll only clear the whole set; if the user is supposed to be in site A but was mistakingly put in site B, I can only remove both sites, and would need to list the devices assigned, then their sites, then manually code the reassignement of the correct site.... Anyway this is again, barbaric. I'm just baffled there's nothing about it in the documentation, and I'm affraid there's no way around tinkering a huge workaround for something that should be simple.