Skip to main content
Question

Using API for software updates.......


Forum|alt.badge.img+8

How is the below code / script to be used in conjunction with the Jamf API?

Also, the url "yourserver".jamfcloud.com - I've tried our server name but no go. We used to be on-prem and now we're jamfcloud, anyone know of to get the name it's looking for?

Thank you!

 

curl --request POST \\
--url https://yourserver.jamfcloud.com/api/v1/macos-managed-software-updates/send-updates \\
--header 'accept: application/json' \\
--header 'content-type: application/json' \\
--data '
{
"skipVersionVerification": false,
"applyMajorUpdate": false,
"forceRestart": false
}
'

2 replies

AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • 2725 replies
  • November 17, 2022

It should be "yourserver".jamfcloud.com, though I would expect this to need credentials to use JAMF API.


Forum|alt.badge.img+8
  • Contributor
  • 37 replies
  • November 18, 2022

Here's a sample full, working MacOS update call that worked with my Jamfcloud instance:

#!/bin/bash #Matthew Prins 2022 #https://github.com/MatthewPrins/Jamf/ #Sample of using API with software updates ########################### #Editable variables #Jamf credentials username="xxxxxx" password="xxxxxx" url="https://xxxxxx.jamfcloud.com" ############################# #Token function -- from https://developer.jamf.com/jamf-pro/docs/jamf-pro-api-overview getBearerToken() { response=$(curl -s -u "$username":"$password" "$url"/api/v1/auth/token -X POST) bearerToken=$(echo "$response" | plutil -extract token raw -) tokenExpiration=$(echo "$response" | plutil -extract expires raw - | awk -F . '{print $1}') tokenExpirationEpoch=$(date -j -f "%Y-%m-%dT%T" "$tokenExpiration" +"%s") } #get token getBearerToken curl --request POST \\ --silent \\ --url $url/api/v1/macos-managed-software-updates/send-updates \\ --header 'accept: application/json' \\ --header 'content-type: application/json' \\ --header "Authorization: Bearer ${bearerToken}" \\ --data '{"skipVersionVerification": false, "forceRestart": false, "groupId": "33"}'

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings