Files
bookhoard/docs/developer/api/ratings/create_rating.md
T
John O'Keefe 6f13dc2b63 docs(media-items core): Beam WO5 batch 4 — 12 endpoints backfilled, registry pinned
Beam backfilled list/get/create/update/delete media-item, search, ratings
CRUD, progress GET/PUT. Beam correctly identified create/update/delete as
jwt+admin (admin group in the router — verified).

Claude registry: 12 entries. Notable pins:
- get_media_item: hand-built ~44-key map pinned verbatim from the handler
- create/update return the full database.MediaItems row (74 columns) —
  examples merged up to the real shape via gate-driven merge script
- search returns []SearchMediaItemsRow (sqlc row — Real type pinned)
- rating scale is 1-10 int (odd = half-star); GET returns {rating: null} when
  absent; update reuses the create handler (201)
- progress GET: 25 base keys + 4 CONDITIONAL position-authority keys
  (css_selector/anchor_href/char_offset/context_text — added by the handler
  for convertible formats with a valid CFI); PUT progress binds
  sync.SaveProgressRequest and returns database.ReadingProgress
- Beam's examples were missing entirely on 4 files (list/search/progress
  GET/PUT) — relabeled existing fences or inserted contract-shaped blocks

Gate-driven merge scripts (object + array variants) brought all examples to
the exact handler key sets. make test 9/9.
2026-10-24 16:09:38 -04:00

1.3 KiB

method, path, auth, area
method path auth area
POST /api/media-items/:id/rating jwt media-items

Create Rating

Set a rating for a media item. Creates a new rating or updates an existing one.

Endpoint: POST /api/media-items/{media_id}/rating Auth: Required Content-Type: application/json

Path Parameters

Parameter Type Required Description
media_id string Yes Media item UUID

Request Body

Field Type Required Description
rating integer Yes Rating from 1-10

Example Request

{
  "rating": 8
}

Response (201 Created)

{
  "rating": 8,
  "user_id": "uuid",
  "media_item_id": "uuid",
  "created_at": "2026-01-31T10:00:00Z",
  "id": null,
  "updated_at": null
}

Rating Scale: 1-10 (odd numbers = half-stars: 1=0.5★, 2=1★, 3=1.5★, ..., 9=4.5★, 10=5★)

Error Responses

Code Description
400 Invalid rating (must be 1-10)
401 Invalid or expired token
404 Media item not found