Skip to main content
Question

Deleting Mobile Devices from JAMF API

  • June 5, 2019
  • 1 reply
  • 7 views

Forum|alt.badge.img+3

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

Chris_Hafner
Forum|alt.badge.img+27
  • Jamf Heroes
  • June 12, 2019

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