Removing all classes at once

BGSICTSupport
New Contributor III

Does anyone have a way of deleting all Classes in Casper at once? We imported from Apple school manager a couple of times and now have duplicates (1,780 classes), all of which aren't formatted properly. We would like to remove all and start again.

Any ideas?

6 REPLIES 6

blackholemac
Valued Contributor III

JAMF makes a product called SIS Importer that can delete all the classes prior to an import with that tool. I still use that tool to import my Apple Classroom classes (though we want to use Apple School Manager eventually once full PowerSchool integration comes)

https://jamfnation.jamfsoftware.com/viewProduct.html?id=248&view=info

peter
New Contributor III

I use the API for this pretty regularly.

for n ({1..100}); do curl -kvu username:password https://myjssaddress.jss:8443/JSSResource/classes/id/$n -X DELETE; done;

Replace 1..100 with your min/max classroom ids. Might take a few minutes, but usually isn't too bad.

jchurch
Contributor II

error in your syntax.
I had to use

for n in {1..900}

bughollow
New Contributor III

I have managed to sync with PowerSchool and the server, but still have old records. The recent update to ASM caused another 'hiccup' in my database. I would like to remove all of the imported classes (and users). Are you willing to share the complete script?

Got it - had the best CCT instructor ever!! Found my notes and figured it out!

Pauljmiddleton
New Contributor

Sorry to drag up an old post but i'm completely new to this API/CURL/Python stuff and it's taken me a day and a half just to get to a point of being able to use Python and get some form of a script together to delete classes, rather than post a VERY long list of steps I've created a blog containing all the steps to get this done from installing Python and installing modules to the python script I've used:

https://middletonhome.wordpress.com/2019/01/11/jamf-deleting-classes-python-with-api/

Hopefully it will help those of you who are like me and a bit new to this. It's probably not the prettiest script in the world but it works!

bcassidy
New Contributor II

sahtudec: Would you please share how you did it?