Skip to content

vitorsilverio/libraryapi

Repository files navigation

libraryapi

deploy lint Snyk CodeQL Analysis Tests Dockerhub

An API to get MARC (Machine-Readable Cataloging) data in many formats (MARC ISO, MARCXML, mnemonic MARC, JSON) from ILS like Pergamum.

Update

If you use an instance of Pergamum version 10 or you want to use a JavaScript tool that uses API, see the Get Pergamum Marc Records tool.

Running

Using Docker

  • docker pull vitorsilverio/libraryapi:main
  • docker run -d --name libraryapi -p 8000:80 vitorsilverio/libraryapi:main

Locally

  • Make sure you have Python 3.12+ installed. You may have to prefix pip and uvicorn commands with python3.12 -m if you have more than one Python interpreter.
  • Install Pipenv with pip: pip install --user pipenv
  • In Ubuntu 22.04: export SETUPTOOLS_USE_DISTUTILS=stdlib
  • pipenv install --deploy
  • pipenv shell
  • uvicorn app.main:app --port 80 append --reload if you are developing and change the port

Endpoints and services

Check the endpoints in documentation page at http://deploy-ip:port/docs

Demo

See a working demo instance:

Examples (version 2)

Using query params:

  • A MARC ISO 2709 record from Pergamum:

https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967?url=https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php&media_type=application/marc

  • A MARCXML record from Pergamum:

https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967?url=https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php&media_type=application/xml

  • A mnemonic MARC record (MARCMaker/MarcEdit format) from Pergamum:

https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967?url=https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php&media_type=text/plain

  • A JSON MARC record from Pergamum (default, if no "media_type" is specified or if it is "application/json"):

https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967?url=https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php&media_type=application/json

Using headers:

  • A MARC ISO 2709 record from Pergamum:
curl "https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967" \
-H "Server: https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php" \
-H "Accept: application/marc"
  • A MARCXML record from Pergamum:
curl "https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967" \
-H "Server: https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php" \
-H "Accept: application/xml"
  • A mnemonic MARC record (MARCMaker/MarcEdit format) from Pergamum:
curl "https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967" \
-H "Server: https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php" \
-H "Accept: text/plain"
  • A JSON MARC record from Pergamum (default, if no "media_type" is specified or if it is "application/json"):
curl "https://libraryapi.sites.ufsc.br/api/v2/pergamum/64967" \
-H "Server: https://pergamumweb.udesc.br/pergamum/web_service/servidor_ws.php" \
-H "Accept: application/json"

Version 1 style (deprecated)

Contributing

Please read Contibution.md to know how to contribute code or buy me a ☕