Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
Created October 27, 2018 23:13
Show Gist options
  • Save talkingmoose/1533e8268b89491c1a67ef0ffbafd774 to your computer and use it in GitHub Desktop.
Save talkingmoose/1533e8268b89491c1a67ef0ffbafd774 to your computer and use it in GitHub Desktop.
Programmatic method to change a Jamf Pro server's Activation Code via the Classic API.
#!/bin/bash
# server connection information
URL="https://jss.talkingmoose.net:8443"
userName="JSSAPI-Editor"
password="password"
# XML data to upload
THExml="<activation_code>
<organization_name>Talking Moose Industries</organization_name>
<code>V7OV-XDEU-DOBI-UDEU-7DEU-DOUD-QRUD-EGNR</code>
</activation_code>"
# flattened XML
flatXML=$( /usr/bin/xmllint --noblanks - <<< "$THExml" )
# API submission command
/usr/bin/curl "$URL/JSSResource/activationcode" --user "$userName:$passWord" --header "Content-Type: text/xml" --request PUT --data "$flatXML"
exit 0
@mani2care
Copy link

mani2care commented Jun 27, 2022 via email

@talkingmoose
Copy link
Author

@mani2care Your original message is showing a "conflict" not an "authorization" response. That means there's problem with what you're trying to submit. Are you sure your activation code is valid? Is the XML you're submitting correct? These are not things I can account for in the script.

@mani2care
Copy link

Yes activation key is valid and I used your script to change
I logged call with JAMF let me try with them .

@mani2care
Copy link

mani2care commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment