I’ve used Workflow in the past, but I hadn’t really fully explored it as “click this” instead of “launch this app and run this real quick” never bothered me. Things have changed since then. Hello to Siri Shortcuts in iOS 12! I can now run things by voice.
$org, we use MicroMDM to manage our Mac computers. The benefits to this are that it’s API is fully exposed and that makes things SUPER easy to integrate with. Some members in the MacAdmins Slack had pointed out that there existed an API endpoint to force a DEP sync. This is HUGE! As we are still getting a large number of our devices into DEP, having to wait a while for µmdm to sync was a bit tedious. This was more of a patience issue on my part than a µmdm quirk. I quickly wrote this up in Postman and had a nice interface to run it. I am working on getting some shell alias’ setup for this as well.
I’ve been running iOS 12 since dev beta 1 on my daily driver. It has come a long way, but enjoyable and pleasantly less buggy all the way through to release day. I run it on my daily driver so that I can fully experience any bugs and do more feedback that way. If you find an issue on your daily, it’s rather easy to remember to file feedback (😜)! With Siri Shortcuts + the Shortcuts app now fully available, I started playing around. That’s when I noticed this:
🤔 Interesting. I can specify some headers and everything. Let’s give it a shot.
µmdm uses basic auth to authenticate the API calls. This can be sent as a Base64 Encoded string as a header via
Authorization: Basic BASE64USERPASSSTRING. In
cURL this looks like
curl -X POST \ https://micromdm.url/v1/dep/syncnow \ -H 'Authorization: Basic U25lYWt5IFNuZWFreSwgTmljZSB0cnkgO1AK'
I was able to convert this curl code to the content needed in the Shortcut. To do this, I tried inspecting the file on my computer. It turns out,
.shortcut files are just binary
plists which remind me of Automator workflows. The file is shared below, but there are some things you will need to adjust for this to work right in your environment. All you should need to swap is Lines
82 (unless you are using more potent forms of authentication). You can also set a vocal command for Siri to run this.