-
-
Save talkingmoose/1533e8268b89491c1a67ef0ffbafd774 to your computer and use it in GitHub Desktop.
#!/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 |
Throwing me error like that @iampavan
<title>Status page</title>Conflict
Unable to update the database
You can get technical details here.
Please continue your visit at our home page.
@talkingmoose tried your script its looks the same error
<title>Status page</title>Unauthorized
The request requires user authentication
You can get technical details here.
Please continue your visit at our home page.
tried updating manually from JAMF its throwing me error like
An error occurred while saving the changes
See JAMFSoftwareServer.log for more details
Throwing me error like that @iampavan
<title>Status page</title> ConflictUnable to update the database
You can get technical details here. Please continue your visit at our home page.
@talkingmoose tried your script its looks the same error
<title>Status page</title> UnauthorizedThe request requires user authentication
You can get technical details here. Please continue your visit at our home page.
tried updating manually from JAMF its throwing me error like
An error occurred while saving the changes See JAMFSoftwareServer.log for more details
If Basic authentication
is disabled, then you will need to use Bearer Token authentication
.
Ref : https://developer.jamf.com/jamf-pro/docs/classic-api-authentication-changes
Not sure if this was changed in Jamf Pro 10.35.0 along with adding support for Bearer Token for the Classic API, but looks like it requires the credentials be passed as an encoded string.
I've posted an updated version here:
https://gist.github.com/22f749726318b7523d52259c7b0f4302
@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.
Yes activation key is valid and I used your script to change
I logged call with JAMF let me try with them .
A one-liner:
curl -sku user:pass -H "content-type: text/xml" https://url.jamfcloud.com/JSSResource/activationcode -X PUT -d '<activation_code><code>asdf-1234</code></activation_code>'