Deciding on an API for Biblios
Saturday, May 24th, 2008 by Chris CatalfoAs I continue to work on Biblios in anticipation of its release (soon, I hope!), it is about time to decide on an API.
I have already put into place a simple macro system for batch editing of bibliographic records. The language is Javascript and makes use of a MarcRecord javascript object to manipulate MARCXML records.
Here is a simple example (record is a MarcRecord instance):
// Check to see if record has 856. If so, add subfield $u with url. If not, add a new 856 with url.
if( record.hasField('856') ) {
record.field('856').subfield('u', 'http://www.google.com');
}
else {
record.addField( new Field('856', '', '', [ new Subfield('u', 'http://www.google.com')]) );
}
I would like to provide access to Biblios’ main functions for use by plugins. Here are a few ideas for API functions:
- Run a search
- Run the current search but limited to something
- Save all search results to a folder
- Save record with id n to a particular folder
- Edit record with id n
- Run a macro on all records in a folder
I’d be interested to hear what others think: what they’re used to in other cataloging software and what commands/tools that software might be missing which could be ultimately included in Biblios.
