Update User Class or Group Assignment with jamf API

Mike6
New Contributor

We are building up a python script that fills the Users (Teachers / Students) into the classes with the jamf api. We are doing good so far but we have trouble updating the User Class or Group assignments. We are using the Documentation on https://school.jamfcloud.com/api/docs/

It seems that we can add groups but we want a full upgrade. The user should loose the existing group / class assignments and get the new ones that is in the put. Should we use https://school.jamfcloud.com/api/docs/#api-Users-Update or https://school.jamfcloud.com/api/docs/#api-Classes-Assign_users ?

 

1 REPLY 1

David5vor12
New Contributor II

You can't modify group memberships of a user with the user update endpoint.

The endpoint to update a class/group lets you only add users to a group but not remove them.

The workaround would be to fetch the existing group, delete it, then recreate the group without the user(s) you want removed from the class.