Digital Humanities, University of Bern Digital Humanities, University of Bern DH Lab
  • Lab
  • Programme
  • Assignment
  • Toolbox
  • Student Workflows
  • About
  • Intro to DH ↗
  1. Programme
  2. Session 6
  • Lab
  • Programme
    • Session 1
    • Session 2
    • Session 3
    • Session 4
    • Session 5
    • Session 6
    • Session 7
    • Session 8
    • Session 9
    • Session 10
    • Session 11
    • Session 12
    • Session 13
    • Session 14
  • Assignment
  • Toolbox
  • Student Workflows
    • How to add your workflow here
  • About

  • Introduction to DH (companion course)

On this page

  • In this session
  • APIs, concretely
  • The Zotero API
  • APIs of cultural heritage institutions
  • Exercise
  • Edit this page
  • Report an issue
  1. Programme
  2. Session 6

Session 6

Introduction to APIs

Author
Affiliation

Tobias Hodel

Walter Benjamin Kolleg / Digital Humanities, University of Bern

Published

20 October 2026

Modified

2 September 2026

Hodel Taught by Tobias Hodel.

In this session

  • What an API is, and why it matters for research
  • Calling the Zotero API — including setting up a token
  • APIs of cultural heritage institutions

APIs, concretely

  • Client, server, request, response
  • HTTP methods, status codes, and what a 404 versus a 403 is telling you
  • Endpoints, parameters, pagination
  • JSON and XML as response formats; reading a JSON structure without panicking
  • Authentication: API keys, tokens, and how not to publish yours
  • Rate limits, and being a well-behaved client
  • Tools: the browser, curl, Postman, and Python’s requests
WarningNever commit a token

An API key in a Git repository is a key on the open internet, and deleting it later does not help — the history keeps it. Use an .env file, and put .env in .gitignore. We set this up together.

The Zotero API

Your bibliography, programmatically:

  1. Create an API key in your Zotero settings
  2. Find your user or group library ID
  3. Retrieve items, collections and tags
  4. Request different formats — JSON, BibTeX, CSL JSON
  5. Paginate through a library larger than one response

This is the direct route from your Zotero library to the website you are building in the Intro’s assignment: the site pulls the bibliography rather than you pasting it.

APIs of cultural heritage institutions

A survey of what is actually available, and in what shape:

  • IIIF — the Image API and the Presentation API; why every serious digitisation project uses it
  • OAI-PMH — metadata harvesting, still the backbone of library and archive exchange
  • SPARQL endpoints — Wikidata and others, following on from Session 5
  • Institutional REST APIs, and their very variable quality

A collected list of examples: https://pad.dsl.unibe.ch/p/resed-api-20260129#/

Exercise

Pick an institution relevant to your topic, find its API, retrieve twenty records, and save them as a local file. Then write down, in three sentences, what the API refused to give you.

TipIn parallel in the Intro

Data publication: the web as interface · GitHub Pages

Back to top
Session 5
Session 7
  • Edit this page
  • Report an issue