Audited every request (247 .yml files) against the routes the server
actually registers (extracted from internal/router, group prefixes
resolved). Results:
- 44 stale requests: deleted where the endpoint no longer exists
(universal-progress GET/PUT /api/progress/:id — routes never existed,
the handlers were deleted in H1; queue stats/clear-failed/process;
admin profile page; auth/account) and FIXED where the endpoint exists
under a different path (kobo token-in-path scheme: every
/api/sync/kobo/<seg> and /api/v1/kobo/<seg> URL now carries
{{kobo_device_token}}; /sync/* missing their /api prefix; koreader
/api/v1/koreader/sync/* -> /api/sync/koreader/*; link-book and
unlinked-books moved to /api/devices/:id/sync/*).
- koreader Sync Highlights/Sync Notes pointed at endpoints that never
existed with a body shape to match — rewritten against POST
/api/sync/koreader/bookmarks (the annotations funnel carries
highlights and notes arrays).
- 9 files the GUI refused to load: 4 had bruno-invalid script type
"tests" (converted to after-response), 4 were info/type:collection
doc files with bogus http blocks (converted to folder.yml folder
docs), 1 had a dead pre-YAML schema and no route (deleted).
- devices/koreader requests now carry request-level bearer auth
({{koreader_device_token}}) — they inherited the collection's user-JWT
bearer, which device endpoints rightly reject — and their bodies
reference {{media_item_id}} instead of dead placeholder uuids.
- environments: opds_base_url was empty (every OPDS request missed the
/opds prefix); set to http://localhost:8765/opds and un-doubled the
prefix in opds/scenarios.
Known limitation, for the handoff: bru CLI cannot execute .yml request
bodies (the collection is GUI OpenCollection format; the CLI runner
reads bodies from .bru files only). A .bru migration is the remaining
bruno work if CLI runs are wanted.
107 lines
3.2 KiB
YAML
107 lines
3.2 KiB
YAML
info:
|
|
name: Sync Books from Server to Kobo
|
|
type: http
|
|
seq: 9
|
|
|
|
http:
|
|
method: POST
|
|
url: '{{base_url}}/api/sync/kobo/{{kobo_device_token}}/sync-from-server'
|
|
auth: inherit
|
|
headers:
|
|
- key: Content-Type
|
|
value: application/json
|
|
body:
|
|
type: json
|
|
json:
|
|
force_sync: true
|
|
books:
|
|
- book-uuid-1
|
|
- book-uuid-2
|
|
|
|
docs: |-
|
|
## Sync Books from Server to Kobo
|
|
|
|
Pulls reading progress, annotations, and bookmarks from server to Kobo device.
|
|
|
|
**Method:** POST
|
|
|
|
**Endpoint:** /api/sync/kobo/sync-from-server
|
|
|
|
**Authentication:** Bearer token
|
|
|
|
**Request Body:**
|
|
- `force_sync` (boolean): Force full sync (ignore last sync time)
|
|
- `books` (array, optional): List of book UUIDs to sync
|
|
- If empty, syncs all books with server data
|
|
- If specified, only syncs listed books
|
|
- `sync_options` (object, optional):
|
|
- `since_date` (string): ISO 8601 timestamp for incremental sync
|
|
- `include_annotations` (boolean): Include highlights/notes
|
|
- `include_progress` (boolean): Include reading progress
|
|
- `conflict_resolution` (string): `most_recent`, `server_wins`, `client_wins`
|
|
|
|
**Response:**
|
|
- `synced` (integer): Number of books synced
|
|
- `skipped` (integer): Books with no server changes
|
|
- `failed` (integer): Books that failed to sync
|
|
- `results` (array): Per-book sync results
|
|
- `book_id` (string): Book UUID
|
|
- `status` (string): `synced`, `skipped`, `failed`
|
|
- `progress_pulled` (boolean): Whether progress was downloaded
|
|
- `annotations_pulled` (integer): Number of annotations downloaded
|
|
- `error` (string, optional): Error message if failed
|
|
- `server_timestamp` (string): Server timestamp of sync
|
|
|
|
**Status Codes:**
|
|
- 200: Sync completed
|
|
- 207: Multi-status (some succeeded, some failed)
|
|
- 401: Unauthorized
|
|
- 400: Invalid request
|
|
|
|
**Sync Direction:**
|
|
- **Server → Device** (this endpoint)
|
|
- Device → Server: Use `/sync/kobo/markup` endpoint
|
|
- Bidirectional sync achieved by calling both
|
|
|
|
**Pull Sync Use Cases:**
|
|
- New device setup (download all progress)
|
|
- Device replacement (restore from server)
|
|
- Multi-device sync (pull changes from other devices)
|
|
- Conflict resolution (server wins)
|
|
- Manual "Download from server" operation
|
|
|
|
**Conflict Resolution:**
|
|
- `most_recent`: Latest timestamp wins (default)
|
|
- `server_wins`: Server data always used
|
|
- `client_wins`: Device data preserved
|
|
- Applied per-book, per-item
|
|
|
|
**Sync Optimization:**
|
|
- Incremental sync by default (since last sync)
|
|
- Force sync does full comparison
|
|
- Book-level batching (10 books per batch)
|
|
- Delta transfer (only changed items)
|
|
- Compression for large annotation sets
|
|
|
|
**Kobo Device Behavior:**
|
|
- Device updates local database
|
|
- Progress reflected in reading view
|
|
- Annotations appear in Notebook
|
|
- Bookmarks updated in navigation
|
|
- Conflict warnings shown to user
|
|
- Sync progress displayed on screen
|
|
|
|
**Performance:**
|
|
- Small sync (1-10 books): 2-5 seconds
|
|
- Medium sync (10-50 books): 5-15 seconds
|
|
- Large sync (50-200 books): 15-45 seconds
|
|
- Timeout: 120 seconds
|
|
|
|
**Use Cases:**
|
|
- Initial device sync
|
|
- After firmware update
|
|
- From another device's changes
|
|
- Manual sync request
|
|
- Conflict recovery
|
|
- Data restoration
|