Deleting Mobile Devices from JAMF API

Vasean
New Contributor

I have over 400 devices I am trying to remove from my JSS using the JAMF API and it doesn't seem to be doing anything. Would greatly appreciate any thoughts. See the script below:

#!/bin/sh
NUMBERS="path/to/file.txt"

/bin/cat $NUMBERS | while read SERIAL; do
/usr/bin/curl -X DELETE -u *username*:*password* https://jssurl:8443/JSSResource/mobiledevices/serialnumber/$SERIAL 2>/dev/null
done

exit 0
1 REPLY 1

Chris_Hafner
Valued Contributor II

This is what I do to have our macOS devices delete themselves. I figured that I'd throw this out here in case the curl command arguments or syntax helps. Of course, I am not pulling from a list of serial numbers.

CAM=`networksetup -getmacaddress en1 | cut -c19-35 |sed 's/:/./g'`
curl -k -v -u *username*:*password* https://jssurl:8443/JSSResource/computers/macaddress/$CAM -X DELETE

JAM=`networksetup -getmacaddress en0 | cut -c19-35 |sed 's/:/./g'`
curl -k -v -u *username*:*password* https://jssurl:8443/JSSResource/computers/macaddress/$JAM -X DELETE