Tech Blog

unAPI support for MetaLib

  • Description
unAPI support for MetaLib to enable e.g. Zotero or any other browser plugin with unAPI support to retrieve records directly from MetaLib.  unAPI interface is exposed on the full record display. It does not have any visible elements, but at least Zotero will display a small icon in the browser’s address bar when it detects that the record is available.
  • Author: Ere Maijala
  • Institution: None
  • Year: 2008
  • License: MPL 1.1 / GPL 2.0
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: MPL 1.1GPL 2.0
  • Skill required for using this code: Basic




Programming language



Software requirements

Normal MetaLib installation


Screen captures


Author(s) homepage



Working example


Using the following Ex Libris open interfaces

X-Server, but only one operation (sfx-get-doc) that does not require a license.



Version 1.1

  • Fixed saving records in e-shelf

Version 1.0

  • Initial release

Installation instructions

For documentation purposes we assume the installation directory is /exlibris/nelli/unapi. Any other directory may be used as desired.


The main script and its support files

  1. Untar the package to /exlibris/nelli/unapi
  2. Make sure that is executable (chmod +x
  3. Change the settings in



metalib_urlMetaLib user interface’s address (with the trailing /V)
x-timeoutHTTP request timeout for X services
x-serverMetaLib X-Server address (normally just replace /V with /X)
debugWhether to log debugging information regarding different operations (written to Apache error log)
scratch_dirDirectory for temporary files
You can also alter the available formats. By default the records are available in MARCXML, Dublin Core and RIS formats. Zotero seems to support RIS the best, but it will rather use MODS if available (that is why MODS is disabled by default).



  1. Add ScriptAlias for /unapi pointing to into the proper VirtualHost
    (or global if no vhosts are used) in httpd.conf of MetaLib’s Apache
    (e.g. /exlibris/metalib/m4_2/apache/conf/httpd.conf):


ScriptAlias "/unapi" "/exlibris/nelli/unapi/"

MetaLib templates

You may be able to do all required changes to template files automatically by copying the [diff file] to the instance directory (e.g. /exlibris/metalib/m4_2/ins01) and issuing the following command when logged in as the metalib user:

patch -u -p0 < metalib_unapi.diff

If that doesn’t work, just open the diff file and do the changes manually. The lines marked with – need to removed and lines marked with + added.

That’s it. Then look up a record and check if Zotero shows the icon in the address bar.

TO DO List

Assess whether the built-in RIS format of MetaLib works well enough, or is an external conversion needed.


Page attachments



2 Replies to “unAPI support for MetaLib”

  1. Hi Ere,
    Looking forward to Wednesday…

    I realy like this contribution, it was easy to install but

    Just to be sure:

    1.ShouldScriptAlias “/unapi” “/exlibris/nelli/unapi/”
    be:ScriptAlias “/unapi” “/exlibris/metalib/m4_a/unapi/”

    2. I managed to get this to work on FDB, but not on the my eshelf, is that a known issue?

    Noam Amit

  2. 1. Depends on where you install the script. Like the instructions state in the beginning, /exlibris/nelli/unapi is just an example. Maybe I should highlight that.

    2. No, that wasn’t a known issue, but an example of incomplete testing from my part. A fixed versio


Leave a Reply