- Update api-reference.md with current endpoint list - Update bulk_update_books.md with improved documentation - Update scanner/overview.md to reference scan_library.md
97 lines
2.3 KiB
Markdown
97 lines
2.3 KiB
Markdown
# Bulk Update Books
|
|
|
|
Update multiple media items at once.
|
|
|
|
**Endpoint**: `POST /api/books/bulk-update`
|
|
**Auth**: Required
|
|
**Content-Type**: `application/json`
|
|
|
|
## Request Body
|
|
|
|
| Field | Type | Required | Description |
|
|
|--------|------|-----------|-------------|
|
|
| updates | array of objects | Yes | Array of update operations (see below) |
|
|
|
|
### Update Object
|
|
|
|
| Field | Type | Required | Description |
|
|
|--------|------|-----------|-------------|
|
|
| book_id | string (UUID) | Yes | Media item UUID to update |
|
|
| updates | object | Yes | Fields to update (see below) |
|
|
|
|
### Update Fields
|
|
|
|
| Field | Type | Required | Description |
|
|
|--------|------|-----------|-------------|
|
|
| title | string | No | Updated title |
|
|
| author | string | No | Updated author |
|
|
| genre | string | No | Updated genre |
|
|
| language | string | No | Updated language |
|
|
| tags | array of strings | No | Updated tags (auto-normalized) |
|
|
| contributors | array of strings | No | Updated contributors (auto-normalized) |
|
|
|
|
### Example Request
|
|
|
|
```json
|
|
{
|
|
"updates": [
|
|
{
|
|
"book_id": "550e8400-e29b-41d4-a716-446655440001",
|
|
"updates": {
|
|
"title": "Updated Title",
|
|
"genre": "Science Fiction",
|
|
"tags": ["science fiction", "non-fiction", "ACME CORP."]
|
|
}
|
|
},
|
|
{
|
|
"book_id": "660e8400-e29b-41d4-a716-446655440002",
|
|
"updates": {
|
|
"author": "Updated Author",
|
|
"contributors": ["O'Reilly Media", "Penguin Random House"]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
## Response (200 OK)
|
|
|
|
```json
|
|
{
|
|
"results": [
|
|
{
|
|
"book_id": "550e8400-e29b-41d4-a716-446655440001",
|
|
"success": true
|
|
},
|
|
{
|
|
"book_id": "660e8400-e29b-41d4-a716-446655440002",
|
|
"success": true
|
|
}
|
|
],
|
|
"total": 2,
|
|
"success": 2,
|
|
"failed": 0
|
|
}
|
|
```
|
|
|
|
## Tag and Contributor Normalization
|
|
|
|
The backend automatically normalizes tags and contributors:
|
|
|
|
- **Tags**: Titlecased, punctuation preserved, deduplicated
|
|
- **Contributors**: Original casing preserved, punctuation preserved
|
|
- **Search fields**: Lowercase, no punctuation, stored in `tags_search` and `contributors_search`
|
|
|
|
## Error Responses
|
|
|
|
| Code | Description |
|
|
|------|-------------|
|
|
| 400 | Invalid request data |
|
|
| 401 | Invalid or expired token |
|
|
| 403 | User does not have permission |
|
|
| 404 | One or more media items not found |
|
|
|
|
## Try It Out
|
|
|
|
<!-- API Explorer will be inserted here in Phase 3 -->
|