print “Achtung!\n”x3;

I’ve been particularly productive today, at least as far as externally visible services are concerned. SuperCat is proving to be a mighty beast, and is now the basis of three (count ’em, three) shiny new web APIs.

UPDATE: Bill and I set up the services described here on our externally accessible dev server. The URLs in the body have been updated to links that point at that server.

First up, as promised earlier, here’s the code implementing oISBN, our xISBN clone that sits on top of SuperCat:

sub oisbn {

        my $apache = shift;
        return Apache2::Const::DECLINED if (-e $apache->filename);

        (my $isbn = $apache->path_info) =~ s{^.*?([^/]+)$}{$1}o;
        my $list = $supercat
                ->request("open-ils.supercat.oisbn", $isbn)
        print "Content-type: application/xml; charset=utf-8\n\n";
        print "<?xml version='1.0' encoding='UTF-8' ?>\n";

        unless (exists $$list{metarecord}) {
                print '<idlist />';
                return Apache2::Const::OK;
        print "<idlist metarecord='$$list{metarecord}'>\n";
        for ( keys %{ $$list{record_list} } ) {
                (my $o = $$list{record_list}{$_}) =~s/^(\S+).*?$/$1/o;
                print "  <isbn record='$_'>$o</isbn>\n"
        print "</idlist>";
        return Apache2::Const::OK;

The URL to use that would look like, and the output looks like

<?xml version='1.0' encoding='UTF-8' ?>
<idlist metarecord='424582'>
  <isbn record='348076'>0791036790</isbn>
  <isbn record='341449'>0791009742</isbn>
  <isbn record='302343'>0877549249</isbn>
  <isbn record='265380'>0790704056</isbn>

Next up, the open-ils.supercat rest interface. It’s not yet out on our public dev server, but it allows the use of URLs like and to retrieve bib records and metarecords. The currently supported formats are


  • marcxml
  • mods
  • oaidc
  • srwdc
  • rdfdc
  • opac (redirects to the opac page for the record detail)
  • (and my personal favorite — OpenSearch 1.0 anyone?) RSS 2.0 <item>s


  • mods
  • opac (like record opac format, redirects to the metarecord page in the opac)

The metarecord format list is short due to me not finding any MODS->??? XSLT in short order. I’ll probably have to build them anyway because, while I’m not abusing MODS too badly, it is pretty function specific. It’ll come, it’ll come.

I’ve decided to use the unAPI format response … er … format to list the available transforms for SuperCat. To get the total format listing for both metarecords and records, you go to a URL like, and append /record or /metarecord to get a specific format list. The code for that is a little longer than the oISBN code (and more boring; it’s mostly format list XML generation), but you can find it here inside the supercat sub.

Which leads into the third interface; OpenILS/Evergreen has joined the unAPI club. The URLs follow the r1 version for the unAPI spec, and look like,2006:metabib-metarecord/424582&format=mods. Yeah, that’s a fake info: URI, but it works for us. Any suggestions (other than “get that approved as a real info: uri”) would be graciously accepted.

UPDATE: After some discussion on the gcs-pcs mailing list, I’ve decided to use tag the URI scheme instead of info. Tag URIs can encode information about both the authoritative entity and the time frame in which the URI is valid, and provide some structure that could inspire future reuse by exposing some semantic definition of the data pointed at. It’s also an accepted method of creating ad-hoc URIs that needn’t be registered with a central authority.

UPDATE: (2006-03-04) The tag: URI code is now in place.

IMHO, it’s quite a credit to Dan’s vision that I was able to get the service built in under an hour (after a little help from tholbroo (ack! couldn’t find a link for Todd!) in #code4lib on mod_perl output with a Status-300 response). With the addition of having to handle special HTTP response codes, I’d say 1 hour is a pretty good implementation time target (it was originally “minutes”). The code implementing unAPI is in the same file as the oISBN and SuperCat code. Just look for the unapi sub.

I’ll update the URLs here (and edit the post time so it gets updated in feeds) when we push it out to the dev server, so others can poke it with a sharp stick. I normally try not to do that, but I couldn’t wait to get this post out, and I want others to take a look when it’s available.