Skip to content

Upstream quirks

The VIAF API spec at https://developer.api.oclc.org/docs/viaf/openapi-external-prod.yaml describes an idealized service; the live routes behave differently in ways the client accounts for. All findings were verified live in November 2026.

Content negotiation

  • The old GET /viaf/{id}/viaf.json route answers 404. Every route answers by Accept header: application/xml returns XML, application/json returns JSON. Without an Accept header the routes answer 307 to the HTML site under /en/viaf/. The client therefore sends Accept: application/xml on every request and switches to application/json only for AutoSuggest.
  • A padded id (00000000000102333412) resolves like the bare number.
  • The explain answer advertises maximumRecords default 250, but the server clamps maximumRecords to 10 for the full cluster schema and to 250 for BriefVIAF. The client rejects a page_size above the schema's cap before sending.
  • An empty query parameter (for example query=) does not answer zero records: the route returns HTTP 200 with the SRU explainResponse instead of a search answer. The client rejects an empty query with ConfigurationError before sending.
  • sortKey accepts only holdingscount. Any other value either errors or falls back silently, so the client rejects unknown sort keys before sending.
  • An empty result or an unknown index answers HTTP 200 with numberOfRecords 0, not an error. Malformed CQL falls back to serverChoice silently; no SRU diagnostics element ever appears.
  • A quoted CQL phrase fails differently from a bare term: the search index matches "tolkien" as expected, but the client lets you send whatever CQL you build.

AutoSuggest

  • AutoSuggest returns JSON only with Accept: application/json; otherwise it answers the HTML site.
  • When no hit matches, the JSON result field is null rather than an empty array; the client maps that to an empty list.
  • The matching is a prefix match on the leading words of a display form: austen matches Austen, Jane, 1775-1817, while Austen, Jane and "Austen Jane" answer zero hits. The client sends the query unchanged and does not quote it.
  • The answer carries no total and no paging; the list holds at most 10 hits. Every unknown key in a hit is an authority-source id (lc, dnb, bnf, ...), which the model collects into source_ids.

Cluster documents

  • A full cluster document embeds links elements with crosswalk triples; a popular cluster carries thousands of them plus Document metadata. The parser drops both; models carry the substantive fields only.
  • Source ids repeat per linked source record with nsid variants such as LC|n 79032879 (with embedded double spaces). Models keep the raw text plus the split code and id.
  • Dates arrive as separate birthDate and deathDate strings, not ranges.

Dump access

VIAF publishes full-corpus dumps, but only behind a gated OCLC download agreement; there is no open bulk endpoint. Nothing in this client reads dumps.