Files
bookhoard/bruno/library/Create Library.bru
T
john-okeefe ba31e1491e refactor: update Bruno API collection for media-items system
- Remove all ebook-specific API requests (15 files deleted)
- Rename Scan Ebooks.bru to Scan Media Items.bru
- Update API paths from /api/ebooks to /api/media-items
- Update base URL and environment configuration
- Maintain all existing media-items, library, auth, and progress tests

Aligns Bruno collection with unified media-items API architecture
2026-01-30 13:52:06 -05:00

81 lines
1.7 KiB
Plaintext

meta {
name: Create Library
type: http
seq: 1
}
post {
url: {{base_url}}/api/libraries
body: json
auth: inherit
}
headers {
Content-Type: application/json
}
body:json {
{
"name": "My Ebook Library",
"description": "A collection of technical books and novels",
"type": "ebooks"
}
}
script:post-response {
function onResponse(res) {
let data = res.getBody();
// If successful registration, set token environment variable
if (res.getStatus() === 201 || res.getStatus() === 200) {
if (data && data.id) {
return bru.setEnvVar("library_id", data.id, { persist: true });
}
}
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Create Library
Creates a new library for organizing media items.
**Method:** POST
**Endpoint:** /api/libraries
**Authentication:** Required (Bearer token)
**Request Body:**
- `name` (string, required): Library name
- `description` (string, optional): Library description
- `type` (string, required): Library type
- `"ebooks"`: Electronic books
- `"audiobooks"`: Audio books
- `"videos"`: Video content
- `"other"`: Other media types
**Response:** Library object
- `id` (string): Library UUID
- `name` (string): Library name
- `description` (string, optional): Library description
- `type` (string): Library type
- `is_visible` (boolean): Library visibility status
- `created_at` (string): Creation timestamp
- `updated_at` (string): Last update timestamp
**Status Codes:**
- 201: Library created successfully
- 400: Invalid request data
- 401: Unauthorized
- 403: Forbidden (insufficient permissions)
- 409: Library name already exists
- 500: Internal server error
}