By Jason Snell
December 7, 2018 5:29 PM PT
Adventures in Shortcuts: Posting content using ancient web APIs
This week I got a little envious of Matthew Cassinelli, who was proudly posting how he’s building all these Shortcuts on iOS that let him do cool stuff involving automatically posting things to his blog.
His blog, you see, is WordPress—and there’s a WordPress app with Shortcuts support. Through nobody’s fault but my own, this site is built on Movable Type 4, the ancient blogging tool that I know by heart, which explains why I still use it when it’s woefully out of date.
So I don’t have fancy iOS apps or even fancy iOS-friendly web templates. If I want to post a story from my iPad, I end up loading a page template that was designed years before the iPad was a glimmer in Steve Jobs’s eye and pasting and tapping and zooming.
But wait, I thought. Movable Type has an external posting interface, a web API that lets apps like MarsEdit post into it. And I wondered if I might be able to figure out how to build a Shortcut that did all the interfacing with my blogging software’s ancient API and allowed me to post stories from my iPad without using the Movable Type web interface.
I got stuck a couple of times along the way—thanks to Matthew Cassinelli himself for giving me a couple of pointers, and to MarsEdit author Daniel Jalkut for reminding me of the best way to encode web content in CDATA statements so that an XML parser will accept it—but in the end, I made it happen. I now have two different Shortcuts that post directly into my Movable Type setup.
The first one, which lets me post the latest episodes of my podcasts to the site, is a total knockoff of Cassinelli’s, so I’ll suggest you read his post for inspiration. The item yesterday highlighting this week’s episode of Download was posted from this Shortcut.
The second one is built around my current iOS text editor of choice, 1Writer. In 1Writer I’ve created a very basic custom action that runs this URL:
All this action does is tell a specific Shortcut named Post to Six Colors to run, and passes along a single item as input—the name of the current file I’m working on. The shortcut picks up the baton, loads that file from my Stories folder in Dropbox, parses it, asks a couple of questions, and sends the result to Movable Type.
Along the way I had to dig up a Jay Allen post that detailed an obscure Movable Type preference that I had to change in order to control whether a post sent by this method would automatically go live or be saved as a draft, to be published later. In the post, Allen wrote “I expect this to garner interest from about three or four people in the entire world”—and that was written fifteen years ago.
Yet somehow, there I was on a December day in 2018, sitting in my local Starbucks working on an iPad, and once I read Allen’s post I logged in to my server (via Panic’s Prompt app), edited the mt.cfg settings file with
vi, and—just like that—the whole thing worked perfectly.
Who knows how many people in the world this will garner interest from, but the larger point is that if there’s a web API, you can probably control it via Shortcuts! Below, I present how I use Shortcuts to post content to Movable Type via the XML-RPC API in annotated form.
You can also view the Shortcut here.
[If you appreciate articles like this one, help us continue doing Six Colors (and get some fun benefits) by becoming a Six Colors subscriber.]