Automations with the JAMF Casper Suite JSS API
James Ridsdale
Systems Engineer – dataJAR
As dataJAR expand our customer base and sites we look after and maintain on a daily basis, it’s become increasingly important to create workflows and efficiencies that will essentially make us more productive.
So, how will we do this? Via the API of course! You can find out more on API’s here.
Imagine the API is like the FEDEX delivery man, everyday he has to GET
and POST
parcels (aka a PAYLOAD
), but can only do this efficiently if the GET
or POST
label (aka XML
) has been completed properly. If all goes well, we all get our parcels and moments of joy as we open them (nod my recent Apple Watch delivery).
JAMF Software, creators if the Casper Suite have implemented an API framework to enable external services and systems interface with the JSS (JAMF Software Server). This feature is often talked about, but never really explored which is why we’re bringing your attention to it and its true power.
Our cloud service, datajar.mobi runs multiple JSS’s. Imagine JAMF Software issued dataJAR with a new license key, all well and good. Now imagine having to connect to the JSS and update that license key. On one server this is no problem, on 30 or 40 suddenly this is a real issue and a time consuming process.
Something for you to try in your test environment….
Well, assuming your API is enabled (it might be disabled for security reasons), you can go to: https://jss.yourdomain.com:8443/api
where you will be asked to authenticate before being presented with a list you resources you can GET
and POST
to.
I’m going to use: activationcode
again as an example and present you with the the following sample PAYLOAD
:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<activation_code>
<organization_name>My Organisation Ltd</organization_name>
<XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX>
</activation_code>
Obviously replace your organisation name and activation code with valid details.
We can save this file as activation_code.xml
and put it on the desktop of our Mac (~/Desktop
). Next we can post this to our JSS (or all of our JSS’s) using a great tool called cURL
:
curl -X PUT --insecure --silent --user “${apiUser}":"${apiPass}" “https://${jssURL}”/JSSResource/activationcode -T “~/Desktop/activation_code.xml” --header "Content-Type:text/xml"
Ensure you replace apiUser, apiPass
and jssURL
with the authentication details and valid URL of your test JSS server.
The above should return a code of 201
which means it has been successful. I would encourage you to take a look at everything that can be automated within the system and you too might have a the same eureka moment we did.
If you would like to find our more about the API or would like to speak to one of our consultants about how to implement such automations within your organisation, please contact sales@datajar.co.uk