Posted on 01-11-2023 09:55 AM
We have an app installed on devices in our org that needs relatively frequent removal and reinstall. Most frequently, the user provides their serial number, sometimes the asset tag associated with the device (which is in the jamf pro device inventory record).
jss_url='identifier.jamfcloud.com/'
username=apiuser
password=apipassword
authToken=$(curl -su "$username":"$password" https://"$jss_url"/api/v1/auth/token -X POST)
api_token=$( /usr/bin/plutil -extract token raw - <<< "$authToken" )
#response=$(read -p "enter s/n: ")
response=1070 #this is added for testing adding the device by inventory id
apidata="<mobile_device_application><scope><exclusions><mobile_devices><mobile_device><id>$response</id></mobile_device></mobile_devices></exclusions></scope></mobile_device_application>"
curl -ks https://"$jss_url"JSSResource/mobiledeviceapplications/id/77 -d "$apidata" -x PUT -H "Authorization: Bearer $api_token"
Running this in CodeRunner gives an error
Running the lines in terminal gives no error but the scope does not update.
I cannot figure out why
Posted on 01-20-2023 12:39 AM
Update the "x" in your last curl-command to a uppercase "X".
Lower "x" is for proxy configuration.
Uppercase "X" is for request method.