The curl command can be used to authenticate to an API using a variety of authentication types such as Bearer, OAuth, Token, and of course Basic. To authenticate to the ZuluDesk API, first create an API token. This is done by logging into ZuluDesk, clicking Organization, then Settings, then API, an then clicking on the Add API Key button.
Once you have your API key, your header will look as follows:GET /users HTTP/1.1 User-Agent: curl/7.24.0 X-Server-Protocol-Version: 2 Authorization: Basic YOURTOKENHERExxx000111222== Content-Length: 0
The curl command can do this would be as follows, simply converting these into separate values in the -H or header. The URL provided will do a GET against devices, displaying a list of devices in json:
curl -S -i -k -H "Content-Length: 0" "User-Agent: curl/7.24.0" X-Server-Protocol-Version: 2" "Authorization: Basic YOURAPITOKENxx000111222==" https://apiv6.zuludesk.com/devices/
Once you have the “serialNumber” you can programmatically perform a number of other tasks using a POST. Another example would be obtaining a list of apps, done using the /apps/ endpoint.
curl -S -i -k -H "Content-Length: 0" "User-Agent: curl/7.24.0" X-Server-Protocol-Version: 2" "Authorization: Basic YOURAPITOKENxx000111222" https://apiv6.zuludesk.com/apps/
You can also run a POST in the same fashion. In the following we’ll do that, sending a simple delete command to the group 505
curl -X DELETE -S -i -k -H "Content-Length: 0" "User-Agent: curl/7.24.0" X-Server-Protocol-Version: 2" "Authorization: Basic YOURAPITOKENxx000111222" https://apiv6.zuludesk.com/users/groups/:505
Overall, the ZuluDesk API is pretty easy to use and follow with just some basic curl commands.
Jamf allows you to register a webhook, IFTTT can trigger an action based on a webhook and then has a number of awesome services you can link the ingredients, or variables, that are caught by that webhook listener into other services. One of the easiest ways to see this kind of action is to just journal the response of a registered webhook into a Google Doc. This allows you to see what’s happening on the fly.
Next, you’ll need an IFTTT Platform account. This allows you to create new IFTTT services. Then, create a new service, using the Add Service icon in the top nav bar.
When the service is created, find the API tab and add the service API location URL.
Here, create new trigger, editing [host]/ifttt/v1/test_trigger as endpoint and add “ingredients” these are custom fields. Those properties are parsed in the php file (e.g. name, computer, jssid, etc.).
Now you can go back to IFTTT main site and create a new applet. To do so, search for your service name and click on your trigger for the previous portion – (e.g. Google Sheets).
Finally, in Jamf Pro, add a new webhook which will call the service API’s [host]/ifttt/v1/store endpoint. The php for a service to parse smart group changes would be as follows:
And the entry in your Google Sheet would be similar to the following.
A webhook is a small web trigger that when fired can easily send amount of small json to a web listener. Most modern software solutions support webhooks. They provide an easy way to trigger events from a piece of software to happen in another piece of software.
An example of this is when a smart group change happens in Jamf Pro, do something elsewhere. To start, you register a webhook in Jamf Pro by opening an instance of Jamf Pro, clicking on Settings, clicking on Global Management, and then clicking on Webhooks.
From the Webhooks screen, click New.
At the New Webhook screen, you will see a number of fields. Here,
- Display Name: The name used to identify the webhook in Jamf Pro.
- Enabled: Check to enable the webhook, uncheck the box to disable the webhook.
- Webhook URL: The URL that the json or xml will be sent to (note that you’ll need something at this URL to accept your webhook).
- Authentication Type: None is used for an anonymous webhook and basic can be used to send a username and password to the webhook listener.
- Connection Timeout: How long the webhook will attempt to open a connection before sending data.
- Read Timeout: How long the webhook will attempt to send data for before it turns off.
- Content Type: Choose to send information via xml or json.
- Webhook Event: The type of event that Jamf Pro can send a hook based on.
The options for webhook events include:
An example of a full workflow would be what we did to trigger a Zapier action, documented at http://krypted.com/mac-os-x/add-jamf-pro-smart-group-google-doc-using-zapier/. Here, we look at sending smart group membership changes to a google sheet so we can analyze it with other tools, a pretty standard use case.
A GitHub.io page is a great way to have a portal for the various open source projects your organization maintains or about how to use products from your organization. Some great examples of GitHub.io projects out there include:
All of the above have some things in common, that I think are important:
- The branding is consistent(ish) with company guidelines, so the experience isn’t tooooo dissonant with the main pages
- The salesy part of the branding has been stripped out
- The experience is putting useful content for developers right up front
- Most assume some knowledge of scripting, consuming APIs, and other technical needs
- They showcase and include information to projects
- Projects from multiple accounts are included (even projects owned by other organization if they help put developing more open source projects out there)
Taking all this into account, let’s make a page! To get started, first create a project in your GitHub account with the url of <accountname>.github.io.
Create an index.html page in there (even if it’s just a hello world page). At this point, you’re just writing standard html. You can have standard tags like H1, H2, etc – and import a css elements from another place.
I really like is displaying cards for your GitHub projects. One project that I like to use (I must have tested 30-40) is GitHub-cards. To use that you’ll need to enable Java, as you can tell from the .js. Then you just include a line to display that card, replacing the data-github field contents with the username/projectname of any projects you want to include, as follows (e.g. for the GitHub user/org name jamf and the GitHub project name of KubernetesManifests):
<div class="github-card" data-github="jamf/KubernetesManifests" data-width="400" data-height="" data-theme="default"></div>
One final note, many an organization has a standard css they want to be used when building new web properties, including something like a GitHub site. You can leverage these by calling them out in the header as follows:
<link href="https://www.jamf.com/css/main.css" rel="stylesheet" type="text/css" media="screen">
According to how much is involved in how a given CMS mucks up code, you might have a lot of tweaking to bring elements in and consume them to your orgs spec, but it’s much easier than sifting through rendered source to figure it out on your own. Once published, go to the account name.github.io (in this example, jamf.github.io) and viola, you have a new page!
I’ve been keeping a list of Apple Admin conferences for a few years now. I probably should have versioned it and kept each iteration, but… no need to pollute the interwebs with more outdated stuffs than I already have. So here’s the link for the latest version, updated with all the event dates announced thus far: http://krypted.com/community/macadmin-conferences/
Hope to see you at some!