Wordpress, now with added unAPI!
Update: Mike Giarlo is now maintaining the unAPI Server for WordPress plug-in.
Here’s a unAPI server for Wordpress blogs. It conforms with Revision 1-14 of the unAPI spec, worked out last week at code4libcon. This is based on my OAI-PMH plugin, but unlike its ancestor, the unAPI server is properly plugged into Wordpress’s methods of accessing blog postings. Functionally, it does everything the spec says it should do to distribute oai_dc and MODS records for every blog posting.
- copy this file to the main directory of your Wordpress installation
- choose a URI prefix for your blog, e.g. oai:wallandbinkley.com:quaedam: (I’m using oai prefixes for compatibility with my Wordpress OAI-PMH plugin). Note the final colon.
- edit unapi.php to put your uri prefix in the variable $uriPrefix (right after the initial comment section)
- modify files in /wp-content/themes/:
- in header.php, after the list of “link” elements, add
<link rel="meta" type="application/xml" title="unAPI" xhref="http://your.domain/your-wp-path/unapi.php" />
- in post.php and single.php, under the posting title, add this:
<span title="your:uri:prefix:<?php echo the_ID(); ?>" class="unapi-uri" /></span>
If you’ve already installed the OAI-PMH plugin, just put the new unAPI tags beside the OAI-PMH tags.
I don’t know of a unAPI client to test this with yet, but here are some urls to show the unAPI output for this posting:
- type 1 url, requesting available formats
- type 2 url, requesting formats available for this posting - note that the HTTP status code for the response is 300 Multiple Formats
- type 3 url, requesting a MODS record for this posting
- type 3 url, requesting an oai_dc record for this posting
- some bad urls: non-existent URI, non-existent format, invalid URI format
What next? This is a minimal implementation, without much thought given to what ought to go into a MODS or oai_dc record for a blog posting. The metadata can therefore probably be improved a lot.
Beyond that, let’s think about what can be distributed this way, beyond simple metadata. Should a posting like this, whose sole purpose is to announce the existence of a digital object, also offer metadata about that object as well as about itself? Should one of the unAPI formats be the zipped PHP file? How would we make that work with Wordpress? There’s still lots to think about…
[...] This is a footnote to Dan's posting on 404s and 200s. Judging from the logs, the unAPI posting here caused some confusion for someone's BlogBridge 2.13 desktop RSS aggregator, when it tried to follow one of the unAPI links. Evidently puzzled by the 300 Multiple Choices status code, BlogBridge called the same link again. And again. It stopped about four hours later (now doubt when the machine was shut down), having made 5438 calls. Since then the same client has returned to fetch RSS feeds but it hasn't touched the unAPI links. [...]
[...] I noticed Dan Chudnov's earlier note about the launch of the unAPI website and noted in particular the the unAPI revision 1 specification. I decided to give Technosophia a run through some error cases and some of the errors came up as 400 where they should have been 404 or 406. I made a few minor tweaks to pbinkley's unAPI WordPress plug-in and I believe Technosophia is now fully compliant with unAPI revision 1. [...]
[...] Thanks to Peter Binkley's WordPress unAPI plugin, this news blog is now unAPI-capable. [...]
[...] As in indicated in my prior post, the WordPress plug-in for unAPI service developed by pbinkley has been updated to reflect changes to the unAPI spec through to the current revision. Download the plug-in. [...]
I decided to give Technosophia a run through some error cases and some of the errors came up as 400 where they should have been 404 or 406
[...] Server gives full citation information for posts, including the abstract. Sphere: Related Content (No Ratings Yet) Loading... [...]
[...] unAPI Server muestra la información completa de tus entradas. [...]
[...] unAPI Server da completa información de mención por entradas, incluyendo lo abstracto. (No Ratings Yet) Loading ... [...]
I can't make it work.. :(
FYI: If you stumbled upon this page and you are searching for the files, like me, here is the link to a further developed version based on the code from here: http://lackoftalent.org/michael/blog/unapi-wordpress-plug-in/