Files
bookhoard/docs/developer/api/collections/set_chain_order.md
T
John O'Keefe 8aa66a30fc docs(api): sync mirrors with the retired rules CRUD and the chain-order endpoint
Three mirrors had drifted:

- The rules-endpoint retirement (4f71eda6) deleted the routes but not
  their mirrors: removed docs/developer/api/collections/
  {add_auto_assign_rule,remove_auto_assign_rule,test_rule,update_rule}
  .md + their bruno twins, and pruned /api/collections/test-rules,
  /{id}/rules, /{id}/rules/{ruleId} from the generated openapi spec
  (hand-edited — regenerating with -update would wipe hand-authored
  bruno suites that predate the docs mirrors).
- New endpoint PUT /api/collections/:id/view-settings gets a doc page
  + schema-registry entry + bruno mirror (repo convention: the route
  and its docs land together).
- 54 pre-existing TestDocsMatchRoutes failures: the media-item
  endpoints emit the 16 episode/download fields (source_feed_id,
  feed_position, download_state, enclosure_url, hosts/guests, …) and
  libraries emit purpose/allow_member_feeds, but the doc examples
  were never extended — the package only runs on the host, so the
  container suite never caught it. Examples now carry every key the
  handlers emit; internal/docs is fully green.
2026-10-31 15:40:21 -04:00

1.3 KiB

method, path, auth, area
method path auth area
PUT /api/collections/:id/view-settings jwt collections

Set Collection Chain Order

Sets the curated listening order for the collection's episode sequence (plan §10 R2): the chain producer (buildSmartCollectionSequenceContext) plays Play as Sequence in this order. The key merges into the collection's view_settings JSONB — playlist toggles that share the document survive the write. Owner-only.

Example request

{
  "chain_order": "newest"
}

Example response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "chain_order": "newest",
  "view_settings": { "chain_order": "newest" }
}

Fields

Field Type Required Notes
chain_order string Yes One of native, newest, oldest, reverse; native/empty removes the stored key

Errors

Status Body When
400 {"error": "invalid collection id"} malformed id
400 {"error": "chain_order must be one of: native, newest, oldest, reverse"} unknown order
404 {"error": "collection not found"} unknown id
401 / 403 — missing JWT / not the owner