Files
bookhoard/bruno/ebooks/Create Ebook.bru
T

62 lines
1.3 KiB
Plaintext

meta {
name: Create Ebook
type: http
seq: 3
}
post {
url: http://localhost:8765/api/ebooks
body: json
auth: inherit
}
body:json {
{
"title": "Sample Book",
"author": "Sample Author",
"isbn": "1234567890",
"description": "A sample ebook",
"file_path": "/uploads/sample.epub",
"file_size": 1024000,
"mime_type": "application/epub+zip",
"cover_image_path": "/uploads/cover.jpg"
}
}
script:post-response {
function onResponse(res) {
let data = res.getBody();
let token = bru.setEnvVar("ebookid", data.id, { persist: true });
}
onResponse(res);
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Create Ebook
Creates a new ebook entry in the library.
**Authentication:** Required (Bearer token)
**Request Body:**
- `title` (string, required): Book title
- `author` (string, optional): Book author
- `isbn` (string, optional): ISBN number
- `description` (string, optional): Book description
- `file_path` (string, required): Path to ebook file
- `file_size` (number, optional): File size in bytes
- `mime_type` (string, optional): MIME type
- `cover_image_path` (string, optional): Path to cover image
**Response:** Created ebook object
**Error Responses:**
- 401: Invalid authentication
- 400: Invalid request data
}