After the recent incident, we have restored access to the website from outside the CERN network, however access from certain worldwide locations is still being blocked.

CERN Accelerating science

Record API


============
 Record API
============

The search module exposes records via `/record` URLs.  You can
manipulate URL parameters to alter output format in order to return
interesting information in API like manner.

1. XML API
==========

Syntax:

   GET /record/?of=...&ot=...

Parameters:

   of = output format (e.g. `xm` for MARCXML)
   ot = output tags (e.g. `` to get all fields, `100` to get titles only)

Pros:

   Eesy web search -> API search context switch.  Uses the same
   parameters as in visible UI.

Cons:

   The XML API output covers only MARC metadata.

Notes:

   The master format of Invenio records is usually MARC.  Hence
   chances are you would like to use `of=xm` output format parameter
   in your XML API queries in order to get the richest data.

Example: (return only record ID, first author, and title of a record)

   GET /record/451647?of=xm&ot=100,245

   <?xml version="1.0" encoding="UTF-8"?>
   <collection xmlns="http://www.loc.gov/MARC21/slim">
   <record>
     <controlfield tag="001">451647</controlfield>
     <datafield tag="100" ind1=" " ind2=" ">
       <subfield code="a">Maldacena, Juan Martin</subfield>
       <subfield code="i">INSPIRE-00304313</subfield>
       <subfield code="u">Harvard U.</subfield>
     </datafield>
     <datafield tag="245" ind1=" " ind2=" ">
       <subfield code="a">The Large N limit of..</subfield>
     </datafield>
   </record>
   </collection>

2. JSON API
===========

Syntax:

   GET /record/?of=...&ot=...

Parameters:

   of = output format (e.g. `recjson` for JSON)
   ot = output tags (e.g. `` to get all fields, `number_of_citations` to get citation counts only)

Pros:

   The JSON API cover field abstraction (support for virtual fields,
   e.g.  number of citations or book circulation counts) as well as
   master format abstraction (e.g. UNIMARC, EAD).

Cons:

   May be slow at times if `recjson` is not cached on the server.
   (See `CFG_BIBUPLOAD_SERIALIZE_RECORD_STRUCTURE`.)

   Not yet REST-ified; just an evolution of HTTP XML API described
   above.

Example: (getting citation counts)

   GET /record/451647?of=recjson&ot=recid,number_of_citations,authors,title

   {
     "recid": 451647,
     "number_of_citations": 9739,
     "authors": [{
         "INSPIRE_number": "INSPIRE-00304313",
         "affiliation": "Harvard U.",
         "first_name": "Juan Martin",
         "last_name": "Maldacena",
         "full_name": "Maldacena, Juan Martin"
     }],
     "title": {
        "title": "The Large N limit of ... ity"
     }
   }

3. Python API
=============

Signature:

   def get_record(recID)

Signature:

   def print_record(recID, format='hb', ot='', ...)