Created
April 10, 2019 15:12
-
-
Save macnotes/c15667572ba4cd437aa4e64487a2bc06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BaseURL='https://your.jamfcloud.com' | |
UserPass='api:apipass' | |
deviceID='1024' | |
command='ClearPasscode' | |
URL="${BaseURL}/JSSResource/mobiledevicecommands/command/${command}/id/${deviceID}" | |
echo "Sending \"${URL}\"" | |
curl --user "${UserPass}" --request "POST" --header "accept: application/xml" --silent --show-error "${URL}" | |
# Notes... | |
# accept header can also request json. | |
# $deviceID can be a single ID or a comma-separated list. | |
#RESPONSE (API ACCEPTED YOUR REQUEST...): | |
#<?xml version="1.0" encoding="UTF-8"?><mobile_device_command><id>1472</id><uuid>51ffb203-7a5a-4f90-9593-fdb20d936fec</uuid><command>ClearPasscode</command><mobile_devices><mobile_device><id>24</id><status>Command sent</status></mobile_device></mobile_devices></mobile_device_command> | |
# YOU CAN then pause a second then CURL the MOBILE DEVICE COMMAND ID in that response to get updates on the command status... | |
# E.g. : /JSSResource/mobiledevicecommands/id/1472 | |
# YOU COULD GET AN HTML RESPONSE WITH A 200 HTTP CODE FOR SOME ERRORS LIKE MALFORMED URL... | |
# <html> | |
# <head> | |
# <title>Status page</title> | |
# </head> | |
# <body style="font-family: sans-serif;"> | |
# <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p> | |
# <p>The server has not found anything matching the request URI</p> | |
# <p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">here</a>.<br> | |
# Please continue your visit at our <a href="/">home page</a>. | |
# </p> | |
# </body> | |
# </html> | |
# EXAMPLE IF YOU SEND A DEVICE ID THAT DOES NOT EXIST... | |
# <html> | |
# <head> | |
# <title>Status page</title> | |
# </head> | |
# <body style="font-family: sans-serif;"> | |
# <p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Bad Request</p> | |
# <p>Unable to match mobile_device </p> | |
# <p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">here</a>.<br> | |
# Please continue your visit at our <a href="/">home page</a>. | |
# </p> | |
# </body> | |
# </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment