GraphQL API
One GraphQL endpoint reads and edits the whole catalog. Reading requires no authentication; editing requires a token, which you can issue yourself. The catalog keeps every change, names who made it, and can undo it, which is what makes it safe to hand the job to an agent.
Or point your own client at the endpoint:
https://findopera.com/api/graphqlReading
No token required. Search by name, filter recordings by the people on them, or fetch anything by id.
curl -s https://findopera.com/api/graphql \
-H 'Content-Type: application/json' \
-d '{"query": "{ searchOperas(query: \"Boheme\", first: 3) { title } }"}'Name searches ignore case and accents and match on part of a word, so Boheme finds La Bohème. That is worth leaning on: a short distinctive fragment beats a full title somebody may have transliterated differently.
Keeping a copy in sync
Every edit to the catalog is in a change log, recordChanges, read oldest first. Each entry is one version of one record, and its row is the row that version wrote. To keep your own copy of part of the catalog current, read the log once from the start, save the cursor of the last entry, and next time ask only for what came after it.
query ($after: String) {
recordChanges(table: OPERAS, after: $after, first: 500) {
pageInfo { hasNextPage endCursor }
edges {
node {
recordId
deletion { mergedIntoId }
row { ... on OperaRow { id title composerId } }
}
}
}
}An entry with a deletion means that version deleted the record or merged it away, so drop it. Otherwise store its row. Applied in order, the last version of each record wins, and you arrive at the catalog as it stands. A complete example keeps a JSON copy of every opera this way, in Python with nothing to install. The first run reads the whole log, and each run after that fetches only what changed.
curl -O https://findopera.com/examples/sync_operas.py
python3 sync_operas.pyThe whole catalog
sync_catalog.py does the same for every table at once, into a SQLite file. We run it every week and publish the result as a snapshot. Run the script on that file and it fetches only what changed since.
Tokens
Mutations need one, and it raises the read limit too, so send it on every request rather than only on writes. Nobody has to prove who they are. The token is not there to identify you; it is there so the server can tell your requests apart from everyone else's. That is what lets anyone see who made an edit, and find and undo a run of bad ones together.
Authorization: Bearer fo_…Issue one on your account page if you have signed in, or ask for a fresh account with createAccessToken. You see it once, and the server keeps only a hash of it, so you replace a lost token rather than recover it. The username you pick is public and appears on every edit you make; the optional email never does.
Editing
Three mutations for every type in the schema: addSinger, updateRecording, deleteCharacter.
mutation {
updateSinger(
id: "1234"
input: { born: 1927 }
justification: "Born 1927 per https://www.example.org/…"
) { id }
}The same thing over the wire, with the token that makes it yours:
curl -s https://findopera.com/api/graphql \
-H 'Authorization: Bearer fo_…' \
-H 'Content-Type: application/json' \
-d '{"query": "mutation { updateSinger(id: \"1234\", input: {born: 1927}, justification: \"Born 1927 per https://example.org/…\") { id } }"}'Every mutation requires a justification, and it should name a source a later reader can check, along with whatever context makes the change make sense. It is not a formality: records here are immutable and anyone may become an editor, so the reason you give is the whole of what a later reader has to judge the change by. The editorial policy says what counts. You can watch them arrive on Live Changes.
Research that finds nothing to change still deserves writing down. commentSinger and its siblings for every type add a comment to a record's history without changing any field, so the next editor sees what you checked before checking it again. The justification is the comment.
Rate limits
- With a token: 600 requests a minute.
- Anonymous: 60 a minute, keyed on your address.
createAccessToken: 5 an hour.submitFeedback: 60 an hour with a token, 10 an hour without one.
Over one and you get HTTP 429 with a Retry-After header, and a GraphQL error whose extensions.retryAfter is the seconds to wait. Wait that long; do not retry straight away.
Something wrong?
The community maintains the catalog, and it has gaps. If you find one, the fix is to close it; that is what the mutations are for. If you would rather just point at it, every record page has a Report Issue link.
Resources
- Playground: run a query here, no token needed to read.
- schema.graphql: every type and field, about 92 KB.
- llms.md: the full reference, written for an agent to read.