Files
bookhoard/bruno/koreader/Sync Annotations (Per-Book SHA-256).bru
T
john-okeefe 3117ce54ec refactor(bruno): migrate API tests to Bruno DSL format
- Convert all existing .bru files from JSON to Bruno DSL format
- Remove obsolete files (conflicts/api.bru, kobo/Kobo Initialization.bru)
- Update auth configuration to use 'inherit' instead of explicit bearer tokens
- Add comprehensive documentation to all test files
- Improve test scripts with proper assertions and error handling
2026-02-08 20:49:06 -05:00

87 lines
2.0 KiB
Plaintext

meta {
name: KOReader Sync Annotations - Per-Book SHA-256
type: http
seq: 4
}
post {
url: {{base_url}}/api/v1/koreader/sync/bookmarks
body: json
auth: inherit
}
headers {
Authorization: Bearer {{koreader_device_token}}
Content-Type: application/json
}
body:json {
{
"book_uuid": "{{book_uuid}}",
"highlights": [
{
"text": "Quote from book 1",
"pos0": "/6/4[chap1ref]!/4/2/1:0",
"pos1": "/6/4[chap1ref]!/4/2/1:50",
"color": "#ffff00",
"page": 10,
"book_sha256": "{{book_sha256}}"
},
{
"text": "Quote from book 2 (different book)",
"pos0": "/6/4[chap1ref]!/4/2/1:0",
"pos1": "/6/4[chap1ref]!/4/2/1:50",
"color": "#00ff00",
"page": 15,
"book_sha256": "{{another_book_sha256}}"
}
]
}
}
script:post-response {
function onResponse(res) {
if (res.getStatus() === 200) {
const body = res.getBody();
tests('Highlights synced >= 0', body.highlights_synced >= 0);
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## KOReader Sync Annotations - Per-Book SHA-256
Synchronizes annotations (highlights) from KOReader with per-annotation SHA-256 hashes for multi-book sync.
**Method:** POST
**Endpoint:** /api/v1/koreader/sync/bookmarks
**Authentication:** Bearer token (KOReader device token)
**Request Body:**
- `book_uuid` (string): Primary book UUID
- `highlights` (array): Array of highlight objects
- `text` (string): Highlighted text
- `pos0`, `pos1` (string): EPUB CFI positions
- `color` (string): Highlight color (hex)
- `page` (number): Page number
- `book_sha256` (string): SHA-256 hash for this specific book
**Response:**
- `highlights_synced` (number): Number of highlights synced
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 500: Internal server error
**Note:** Each highlight can include its own book_sha256, allowing annotations from multiple books in a single request.
}