IIIF Presentation 2 (/api/iiif/v2/..., and /iiif/...) #
The IIIF routes scta-site served, with the same JSON, at /api/iiif/v2/.... The v2 is the version of the IIIF
Presentation API, not of an SCTA API: Presentation 3 can be added later at /api/iiif/v3 beside it.
/iiif/... is a legacy alias with the same routes. It builds its URLs (@ids of collections, manifests,
sequences, ranges, layers, lists) under /iiif, so it serves exactly what scta-site served: those ids are
referenced from annotations, Mirador configurations and aggregators, and must not change under them. New clients
use /api/iiif/v2, whose @ids are under /api/iiif/v2. (Canvas and image ids come from the graph and are the
same in both.)
Ported 2026-11-27 from scta-site's app.rb (/iiif routes), lib/collections.rb, lib/manifests.rb, lib/ranges.rb, lib/custom_functions.rb
and lib/notifications.rb. Code: src/scta_api/iiif.py (building), src/scta_api/routers/iiif.py (routes).
Known users (all on the /iiif paths today): Mirador at mirador.scta.info (/iiif/{id}/collection,
/iiif/codex/{codex}/manifest), LombardPress viewers, aggregators. Canvas, image and annotation IRIs come from the graph and are passed through.
Routes #
Paths below are relative to /api/iiif/v2 (or /iiif on the alias).
| Path | What |
|---|---|
/{id}/collection |
scta or authors: every author of a top-level work. codices: every codex's official manifest. A person: their top-level works. A work group: its works. A work: its manifestations (born-digital critical editions left out). |
/collection/scta |
302 to /scta/collection |
/codex/{codex}/manifest |
every page of a codex. With no pages in the graph, the codex's official manifest is fetched and passed through |
/{expression}/{manifestation}/manifest |
the pages of one manifestation, with its table of contents as structures |
/custom/{id}/manifest |
every page that holds an instance of {id} (marginalNote for marginal notes) |
/{e}/{m}/ranges/toc/wrapper |
the table of contents as one wrapper range |
/{e}/{m}/supplement/{ranges/toc, service/searchwithin, layer/transcription} |
supplements (an old draft IIIF pattern) |
/{e}/{m}/notification/{…same} |
the same as notifications (Announce) |
/{e}/{m}/service/searchwithin |
the search service description (IIIF Search 1.0, /{e}/{m}/search) |
/{e}/{m}/layer/transcription |
the transcription layer: one page annotation list per page |
/{e}/{m}/list/transcription/{folio} |
one annotation per paragraph zone on a page |
/iiif-presentation-context.jsonld, /iiif-image-context.jsonld |
the context files (copied from scta-site's public/) |
From the line index (only under /api/iiif/v2) #
New resources, built on the line index (lines.py; design: docs/lines-redesign.md, step 4), replacing
eXist's annotation lists and search within in the manifests (2026-12-04). They have no scta-site URL, so they
are only under /api/iiif/v2, and the manifests the /iiif alias serves point there too.
| Path | What |
|---|---|
/codex/{codex}/list/lines/{page} |
a page's lines: one annotation per line with a box and text (on = canvas#xywh, chars = the line's text). The expression manifests' "by line" otherContent |
/codex/{codex}/list/page/{page} |
a page's whole text, one line per line, as one annotation on the canvas (from the TEI, so also for pages with no coordinates yet). The codex manifests' otherContent and the transcription layer's lists |
/codex/{codex}/search?q=&page= |
IIIF Search API 1.0 within a codex: the lines matching q (the corpus search's syntax), 100 a page (page from 1), each an annotation with the same @id as in the line list. motivation, date, user are not supported and listed in ignored |
/{e}/{m}/search?q=&page= |
the same within a manifestation (one work in one witness: the lines of its items) |
An annotation's @id ends in <page>/<n>, the line's number: clients find a line by it, not by its position in
the list (a line with no box, or no text, is left out). A codex not in the line index has no lists and no hits:
its data is to be finished and exported (scta-coordinates), not worked around here.
Parity with scta.info #
scripts/iiif_parity.py fetches each path from scta.info and from this app and compares the parsed JSON
(the local origin is rewritten to https://scta.info first). By default it checks the /iiif alias;
SCTA_NEW_PREFIX=/api/iiif/v2 checks the new paths, rewriting their prefix to /iiif before comparing. On 2026-11-27: every route in its default sample
is identical apart from the fixes below (18 paths), and so are 25 random works' collections with up to two
manifests each (47 paths). On 2026-11-28, after the move to /api/iiif/v2, the default sample was
identical again on both prefixes. The one difference found, blank-node ids (b0 vs scta-site's _:b0), was fixed in
sparql.py.
Deliberate differences (bugs fixed) #
- Codex manifests: image width. scta-site wrote the image's height as its width (
create_manifest). - Range labels that were null. In
create_range2(works without top divisions) a misspelt key (part_itle) left the label of every range that has sub-ranges null. - A collection that answered 500. In
create_collection, a manifestation with no pages whose official manifest was the placeholderhttp://localhost:3030/ds/data?defaulthit an undefined variable (idbase), so the whole collection failed. It now gets its scta.info manifest URL. - scta.info URLs come from the request's origin (https://scta.info when deployed). scta-site wrote
https://scta.infoliterally in manifests and ranges; the deployed output is the same. - Notification timestamps are the time of the request (as before), so they never compare equal.
Kept on purpose, though odd: range numbering by position among all items (not within the division), duplicate
child ranges in create_range2, custom-manifest canvas sizes as strings, and (until 2026-12-04, when the
lists and search moved to the line index) the eXist URLs in otherContent and the search service.
Not ported (stay on scta-site until retired) #
/iiif/{msname}/manifest(one path segment): 70 static manifests from 2016 in scta-site'spublic/(19 MB), marked deprecated in the code./iiif/{slug}/list/translation/{folio}and/list/comments/{folio}: hard-coded test files./iiif/{id}/collection_old,/iiif/testrange/...: deprecated or test routes./iiif/{e}/{m}/supplement/layer/translation,/layer/comments,/layer/translation: scta-site answered these withnull(an unhandled type).
/api/iiif/v2/ can go to this app whole. But the Traefik rule for the /iiif alias must not take all of /iiif/: it should match the ported patterns (e.g. a
PathRegexp for /iiif/[^/]+/collection, /iiif/codex/…, /iiif/custom/…, and the two-segment
/iiif/{e}/{m}/… routes), leaving one-segment /iiif/{msname}/manifest to scta-site.
eXist #
Since 2026-12-04 these manifests no longer point to eXist (see "From the line index"). eXist's own URLs
(folio-annotation-list.xq, folio-annotaiton-list-from-simpleXmlCoordinates.xq, /iiif/{codex}/search,
/iiif2/{slug}/search) keep running on eXist for the apps and components that call them directly; scta-api
doesn't alias them. scta-site's manifests still point to eXist until scta.info's IIIF routes move here.
Open #
- These are the heaviest routes (a manifest is up to ~650 KB, from several SPARQL queries) and change only with the nightly build: the first candidates for caching per build.
- IIIF Presentation 3 could be added later at a versioned path, if viewers need it.