docs(api): document the KOReader resolve endpoint
Add koreader/resolve_book.md for GET /api/sync/koreader/resolve, list the endpoint in the API reference, and describe the resolve-then-pull- then-push linking flow in the KOReader protocol page — including why a device pushing to bootstrap its identity creates progress conflicts for books already mid-read from other sources.
This commit is contained in:
@@ -94,6 +94,41 @@ hash differs from the primary format's hash.
|
||||
}
|
||||
```
|
||||
|
||||
## Book Resolution (UUID lookup)
|
||||
|
||||
**Endpoint**: `GET /api/sync/koreader/resolve?sha256={hash}`
|
||||
**Auth**: Device token required
|
||||
|
||||
Read-only lookup mapping a file SHA-256 to the book's UUID (format-aware,
|
||||
same `BookResolver` path as the progress push). Devices call this on the
|
||||
first open of a newly downloaded book to learn the UUID **before** their
|
||||
first pull. Full details: [Resolve Book](../koreader/resolve_book.md).
|
||||
|
||||
This matters for conflict avoidance: a device that pushes to bootstrap its
|
||||
identity transmits its current (first-page) position, which the server
|
||||
treats as a real progress update — overwriting/conflicting with genuine
|
||||
mid-read progress from other sources. Resolve, then pull, then push.
|
||||
|
||||
### Example Request
|
||||
|
||||
```http
|
||||
GET /api/sync/koreader/resolve?sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
Authorization: Bearer device-token
|
||||
```
|
||||
|
||||
### Response (200 OK)
|
||||
|
||||
```json
|
||||
{
|
||||
"book_uuid": "book-uuid",
|
||||
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"title": "Book Title",
|
||||
"author": "Author Name"
|
||||
}
|
||||
```
|
||||
|
||||
404 when no book in the library matches the hash.
|
||||
|
||||
## KOReader Metadata Fetch
|
||||
|
||||
**Endpoint**: `GET /api/sync/koreader/metadata/{book_uuid}`
|
||||
|
||||
Reference in New Issue
Block a user