Endpoints¶
-
GET/api/facilities¶ List all available facilities.
Request:
http GET "localhost:5000/api/facilities"
Response:
{ "facilities": { "wolfsburg": { "city": "Wolfsburg", "name": "Stadtbibliothek Wolfsburg", "url": "http://webopac.stadt.wolfsburg.de" } } }
-
GET/¶ Landing page.
This is the main page when accessing the app through a web browser. It gives some basic informations and links to the sourcecode and documentary. It also has some kind of API example. You can get a ical link through entering credentials in the form.
-
POST/¶ Landing page.
This is the main page when accessing the app through a web browser. It gives some basic informations and links to the sourcecode and documentary. It also has some kind of API example. You can get a ical link through entering credentials in the form.
-
GET/api/(facility)/ical/lent.ics¶ Returns a calendar for all lent items in the ical format.
The calendar file includes all return dates for all lent items. It can be used for importing them into other calendar software like the Google calendar or Thunderbird Lightning.
Request:
http GET localhost:5000/api/wolfsburg/ical/lent.ics?token=pIUBfh1se
Response:
BEGIN:VCALENDAR PRODID:ics.py - http://git.io/lLljaA VERSION:2.0 BEGIN:VEVENT DTSTAMP:20160609T101434Z DTSTART:20160415T000000Z SUMMARY:Bibliotheksrueckgaben: 2 DESCRIPTION:Dürer\, Albrecht: Albrecht Dürer\nHopper\, Edward: Edward UID:7a3fcb35-2cb4-48d3-ab56-2cf62af04337@7a3f.org END:VEVENT BEGIN:VEVENT DTSTAMP:20160609T101434Z DTSTART:20160420T000000Z SUMMARY:Bibliotheksrueckgaben: 1 DESCRIPTION:Hopkins\, John: Modezeichnen UID:86474116-dfd6-408f-9c2b-2e2cb552ab9b@8647.org END:VEVENT END:VCALENDAR
Parameters: - facility (str) – The facility to get a lent list from.
-
GET/static/bootstrap/(path: filename)¶ Function used internally to send static files from the static folder to the browser.
New in version 0.5.
-
POST/api/(facility)/search¶ Search library for items.
It takes a JSON-object in a POST request. You also can put a request argument with the name “page” to the url for pagnation. Most times the library search forms return more items then they fit on a single page. So they need some kind of pagination. If the page argument is given, it will search for the page number and browse to that page before parsing the result. If not given, it will use the page number “1”. Here is a example:
Request:
http POST "localhost:5000/api/wolfsburg/search?page=4" term="batman"
Response:
{ "next_page": 5, "results": [ { "annotation": "Der Schurke Two-Face wurde durch...", "author": "geschrieben von Matthew K. Manning.", "copies": [ { "available": false, "branch": "01:Kinderbibl. Zentr", "due_date": "2016-02-05", "id": "M1400963", "position": "4.1 Mann", "type": "Kinder- und Jugendliteratur" } ], "cover": "http://foo.bar/images/P/3555829.03.MZZZZZZZ.jpg", "isbn": "978-3-596-85582-7", "title": "Batman - Ein finsterer Plan", "year": "2013-01-01" } ] }
Parameters: - facility (str) – The facility to search in.
-
POST/api/(facility)/token¶ Creates a authentication token.
This endpoint returns a authentication token for a specific facility.
Request:
http POST localhost:5000/api/wolfsburg/token username=foo password=bar
Response:
{ "token": "eyJwYXNzd29yZCI6IjoiZm9vIn0.DmRMyew4ukCAZHsnIrs4PaY8" }
Parameters: - facility (str) – The facility to get a token for.
-
GET/api/(facility)/lent¶ Returns a list of lent items and the saldo of the account.
This view returns all lent items in a list with the title and author plus the date until the item needs to get returned. It also tries to get the saldo of the account.
Request:
http GET localhost:5000/api/wolfsburg/lent?token=pIUBfh1BSvoROF8wgHse
Response:
{ 'saldo': '-36,00', 'items': [ { 'due_date': '2016-04-15', 'author': 'Dürer, Albrecht', 'title': 'Albrecht Dürer' }, { 'due_date': '2016-04-15', 'author': 'Hopkins, John', 'title': 'Modezeichnen' }, { 'due_date': '2016-04-15', 'author': 'Hopper, Edward', 'title': 'Edward Hopper' } ] }
Parameters: - facility (str) – The facility to get a lent list from.