IOS ScheduleOSUpdate does not work, Authorization failed

TomZa
New Contributor

Hello,

we try to update our Mobile devices via the API.

https://developer.jamf.com/jamf-pro/reference/createmobilescheduleosupdatecommandurl

https://yourServer.jamfcloud.com/JSSResource/mobiledevicecommands/command/ScheduleOSUpdate/{install_action}/id/{id_list}

 

nor 

 

https://yourServer.jamfcloud.com/JSSResource/mobiledevicecommands/command/ScheduleOSUpdate/{install_action}/{product_version}/id/{id_list}

 

are working. We get a 401 with a restricted user or a full admin

 

Response:

HTTP/2 401 

date: Thu, 01 Sep 2022 15:12:24 GMT

content-type: text/html;charset=UTF-8

content-length: 424

set-cookie: XYZ; Expires=Thu, 08 Sep 2022 15:12:24 GMT; Path=/

set-cookie: XYZ; Expires=Thu, 08 Sep 2022 15:12:24 GMT; Path=/; SameSite=None; Secure

server: Jamf Cloud Node

strict-transport-security: max-age=31536000; includeSubdomains;

x-frame-options: DENY

cache-control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0

accept-ranges: bytes

x-xss-protection: 1; mode=block

strict-transport-security: max-age=31536000 ; includeSubDomains

set-cookie: APBALANCEID=aws.xxxx; path=/;HttpOnly;Secure;

 

 

anyone know a solution ?

1 REPLY 1

athomson
New Contributor III

Below is the command I use. 

/usr/bin/curl -X POST "$JSS_URL/api/v1/macos-managed-software-updates/send-updates" -H "accept: application/json" -H "Authorization: Bearer $JSS_TOKEN" -H "Content-Type: application/json" -d "{\"deviceIds\":[\"$COMPUTER_ID\"],\"updateAction\":\"DOWNLOAD_AND_INSTALL\",\"forceRestart\": true}" 2> /dev/null | /usr/bin/sed -nE 's/.*"id" : "([A-Za-z0-9\-]+)",.*/\1/p'

Note that:
$COMPUTER_ID is the device ID of the mac within the JSS.  
$JSS_TOKEN is the bearer token for your JSS API account.