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.
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.
-r — bell -i /
clamscan -r — scan-pdf=
.txt — move=
result = `
#Echo Quarantine into EA