Hi, I'm Aaron Parecki, co-founder of IndieWebCamp. I maintain oauth.net, write and consult about OAuth, and am the editor of several W3C specfications. I record videos for local conferences and help run a podcast studio in Portland.
I wrote 100 songs in 100 days! I've been tracking my location since 2008, and write down everything I eat and drink. I've spoken at conferences around the world about owning your data, OAuth, quantified self, and explained why R is a vowel.
I’m always looking for fun and better ways to publish content to my website. There are several nice writing apps now, such as Byword for MacOS, which lets you write in Markdown and then converts it into HTML. Many of these kinds of apps have an option to publish to a Wordpress site, using Wordpress’ XML-RPC interface, which is more or less the MetaWeblog API.
I thought it would be a fun experiment to try to set up my website to handle those XML-RPC calls so that I can use these apps, at least until they support Micropub natively.
As with most XML formats, XML-RPC is ridiculously verbose for what it’s doing. In order to send a single string value, it requires wrapping it in a surprising amount of XML:
<param> <value><string>aaronparecki.com</string></value> </param>
The MetaWeblog API also requires that you give apps your Wordpress password, which has been a known anti-pattern for a long time. With things like OAuth, we have better ways of authenticating against APIs without sending passwords around.
To avoid needing to add actual XML-RPC support to my website, I set up a bridge that translates XML-RPC calls to their equivalent Micropub calls. The bridge also obtains an IndieAuth access token so that I can use a token instead of entering my password into these apps.
I didn’t bother adding any styling to the gateway since it’s something you’d only interact with once to set up, so apologies for the ugly screenshots that follow.
Here’s what it looks like to connect Byword to be able to publish to my website.
First I visit the gateway and log in.
That does the IndieAuth discovery and takes me to my website where I grant it access.
Then I’m redirected back to the gateway which provides instructions on what to do next.
The key to making Byword find the XML-RPC API is adding that
EditURI tag to my website. Then I can go into Byword and add a new Wordpress site, entering my domain name.
It then asks for my username and password, which I enter by copying from the gateway.
Then Byword is all set and thinks it’s talking to a Wordpress site!
Now when I’m ready to publish this post, I click the “Publish” button in Byword, and fill in the title and tags.
If you’d like to try this out, head to xmlrpc.p3k.io and connect your website!
The source code is available on GitHub.
I’ve only implemented the one
newPost method that Byword uses when talking to the XML-RPC API. I’ve only tested this with Byword, so it’s very likely that other apps might be expecting more of the API to be implemented. Feel free to file issues if you have trouble using other apps! Eventually I’d like to implement more of the MetaWeblog API in this gateway, even if I really don’t like writing XML-RPC code!