Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programmatic interaction with the Invenio-based NADRE Repository

Similar presentations


Presentation on theme: "Programmatic interaction with the Invenio-based NADRE Repository"— Presentation transcript:

1 Programmatic interaction with the Invenio-based NADRE Repository
Mr. Mario Torrisi (PI4 – Italy – 8 October 2018 – First NADRE Training Workshop – Gondar (Ethiopia)

2 Overview Search engine API Upload records GitHub repository XML API
Outline Overview GitHub repository Search engine API XML API JSON API Search engine API hands-on Upload records MARCXML file Upload records hands-on curl php

3 Overview For this tutorial you can refer to Github project repository, that collects all the examples you will see: Clone or download this repository on your system as shown in this video

4 Invenio offers three different kinds of APIs XML API JSON API
Search engine API Allows you to search digital asset on the NADRE Repository, sending HTML requests Invenio offers three different kinds of APIs XML API Will return output in MARCXML JSON API Internally, Invenio records are represented in JSON, so you can ask for JSON output format Python API Invenio Search Engine can be called from within your Python programs (this API is not covered in this tutorial)

5 XML API

6 GET /search?p=...&of=...&ot=...&jrec=...&rg=...
XML API Using XML API Invenio replies with an XML containing the records found Syntax: GET /search?p=...&of=...&ot=...&jrec=...&rg=... Example: Get the first 10 records in XML format Parameters jrec - jump to record ID (e.g. 1 for first hit) rg - records in group (e.g. 10 hits per page) of - output format (e.g. Xm for XML format) Full list of parameters: link

7 Paginate results (XML API)
Set jrec and rg properly to paginate the output Example Do not set rg too high – there is a server-wide safety limit for it

8 Look for patterns in fields (XML API)
Get the first 10 records that contain the string “Hackfest” in the title: Parameters p - pattern (e.g. your query) f - field to search within (e.g. “title”, “authors”, etc.) Get the first 10 records in 'PRESENTATIONSNADRE' collection that contain 'NADRE' in keyword: p1 - first pattern to search for

9 Filter records and outputs in NADRE Repository (XML API)
Get all records uploaded from a given date (e.g ) to another given date (e.g ) Parameters d1 - is the first date in `YYYY-mm-dd` format d2 - is the second date in `YYYY-mm-dd` format Get only the abstract, title and authors of a resources ot: output tags, that is a comma separated lists of tags should be shown (e.g. ‘’ to get all fields, ‘title’ to get titles only)

10 JSON API

11 JSON API Internally, Invenio records are represented in JSON. You can ask for JSON output format (`of=recjson`) Syntax: GET /search?p=...&of=...&ot=...&jrec=...&rg=... Example: Get the first 10 records in XML format Parameters jrec - jump to record ID (e.g. 1 for first hit) rg - records in group (e.g. 10 hits per page) of - output format (e.g. Xm for XML format)

12 Paginate results (JSON API)
Set jrec and rg properly to paginate the output Example Do not set rg too high – there is a server-wide safety limit for it

13 Look for patterns in fields (JSON API)
Get the first 10 records that contain the string “Hackfest” in the title: Parameters p - pattern (e.g. your query) f - field to search within (e.g. “title”, “authors”, etc.) Get the first 10 records in 'PRESENTATIONSNADRE' collection that contain 'NADRE' in keyword: p1 - first pattern to search for

14 Filter records and outputs in NADRE Repository (JSON API)
Get all records uploaded from a given date (e.g ) to another given date (e.g ) Parameters d1 - is the first date in `YYYY-mm-dd` format d2 - is the second date in `YYYY-mm-dd` format Get only the abstract, title and authors of resources ot: output tags, that is a comma separated lists of tags should be shown (e.g. ‘’ to get all fields, ‘title’ to get titles only)

15 Search engine API hands-on

16 Search engine references
To know more about XML, JSON and Python API of an Invenio based OAR visit this guide:

17 Upload records

18 Send an IP address authorization request
Upload records Send an IP address authorization request Create a MARCXML file as input (e.g. your_file.xml) that describes the resources you’re going to upload to NADRE Repository Submit this XML file to the Repository: curl –T your_file.xml -A invenio_webupload -H “Content-Type: application/marcxml+xml” A generic file you can use as template for your submission can be found at:

19 Must be compliant with MARCXML standard
your_file.xml (1/3) Must be compliant with MARCXML standard Must have only one <collection…> tag <collection…> can have one or more <record…> that represents the resource

20 Each record has many <datafield…> tags
your_file.xml (2/3) Each record has many <datafield…> tags tag value refers to a corresponding MARCXML metadata Each <datafield…> can have many <subfield…> that are the metadata values based on the code attribute value

21 Digital Object Identifier (MAN) (NR)
your_file.xml (3/3) Digital Object Identifier (MAN) (NR) tag=”024” Main author (MAN) (NR) tag=”100” Other authors (R) tag=”700” Keyword (R) tag=”653” Collection (MAN) (NR) tag=”980” (MAN) Mandatory tag, (NR) not repetitive, (R) repetitive

22 Upload records hands-on

23 Upload records references
BibUpload admin guide MARCXML

24 Thank you! አመሰግናለሁ!


Download ppt "Programmatic interaction with the Invenio-based NADRE Repository"

Similar presentations


Ads by Google