I've been fumbling around with this for a bit now and I'm feeling pretty stuck.
I'm trying to get all the iOS devices in a specific SmartGroup to reboot via a script.
groupid=104
jssAddress="https://myurl:8443"
devices=$(curl -sku "${jssAPIUsername}:${jssAPIPassword}" -H "Content-Type: text/xml" "${jssAddress}/JSSResource/mobiledevicegroups/id/${groupid}" | xmllint --xpath //id - | sed -e "s/<id>${groupid}</id><id>-1</id>//" | sed -e 's/</id><id>/,/g' | sed -e 's/id/id_list/g' )
#devices=$(curl -sku "${jssAPIUsername}:${jssAPIPassword}" -H "Content-Type: text/xml" "${jssAddress}/JSSResource/mobiledevicegroups/id/${groupid}" | xmllint --xpath //id - | sed -e "s/<id>${groupid}</id>//" | sed -e 's/<id>-1</>//' )
#devices="<id>8</id>"
data="<mobile_device_command><general><command>RestartDevice</command></general><mobile_devices><mobile_device><id>${devices}</id></mobile_device></mobile_devices></mobile_device_command>"
#echo $devices
echo "~~~~~~~~~~~~"
echo $data
curl -sku "${jssAPIUsername}:${jssAPIPassword}" -H "Content-Type: text/xml" "${jssAddress}/JSSResource/mobiledevicecommands/command" -d $data -X POST
I get "Bad Request" "Unable to match mobile device"
It doesn't appear to have pushed to any of the devices.
Does anyone have some experience with this that wants to lend a set of eyes? The troubling part is getting the devices selected. Operating on a single device isn't a problem.
Thanks in advance for any help provided.
