-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
Base URL: http://localhost:8080/api
All protected endpoints require the header:
Authorization: Bearer <jwt_token>
POST /api/auth/login
Body:
{"username": "admin", "password": "Admin1234!"}Response:
{
"message": "Login successful",
"token": "eyJ...",
"user": {"id": "uuid", "username": "admin", "email": "...", "full_name": "...", "role": "admin"}
}POST /api/auth/register
Body:
{"username": "john", "email": "john@example.com", "password": "MyPass1234!", "full_name": "John Doe"}GET /api/auth/me
PUT /api/auth/profile
Body (all fields optional):
{"full_name": "New Name", "username": "newuser", "email": "new@example.com"}PUT /api/auth/password
Body:
{"current_password": "OldPass123!", "new_password": "NewPass1234!"}GET /api/books?search=&language=&genre=&read_status=&sort_by=created_at&sort_dir=DESC&page=1&per_page=25
GET /api/books/{id}
Returns book details + lending history.
POST /api/books
Body:
{
"title": "Book Title",
"author": "Author Name",
"genre": "Fiction",
"language": "arabic",
"publication_year": 2020,
"isbn": "9781234567890",
"edition_house": "Publisher",
"num_pages": 350,
"location_room": "Living Room",
"location_shelf": "Shelf A",
"shelf_id": "uuid-of-shelf",
"publisher_id": "uuid-of-publisher",
"read_status": false,
"series_name": "",
"series_position": null,
"notes": ""
}PUT /api/books/{id}
Body: Same fields as create (all optional).
DELETE /api/books/{id}
POST /api/books/{id}/toggle-read
POST /api/books/isbn-lookup
Body:
{"isbn": "9781234567890"}POST /api/scan/cover
Body:
{"image": "data:image/jpeg;base64,..."}Response:
{
"data": {
"parsed": {"title": "Ψ§ΩΨ³ΩΨ© Ψ§ΩΩΨ¨ΩΩΨ©", "author": "Ω
ΨΩ
Ψ― Ψ§ΩΨΊΨ²Ψ§ΩΩ"},
"matches": [],
"found": false
}
}POST /api/scan/back
Response includes: isbn, edition_house, publication_year, title, author
GET /api/locations/tree
Returns nested structure: addresses β rooms β shelves.
GET /api/locations
GET /api/locations/{id}
Returns address + rooms + shelves with book counts.
POST /api/locations
PUT /api/locations/{id}
DELETE /api/locations/{id}
GET /api/locations/{address_id}/rooms
POST /api/rooms (body: {address_id, name, floor, description})
PUT /api/rooms/{id}
DELETE /api/rooms/{id}
GET /api/rooms/{room_id}/shelves
POST /api/shelves (body: {room_id, name, description, capacity})
PUT /api/shelves/{id}
DELETE /api/shelves/{id}
GET /api/publishers?search=
GET /api/publishers/{id}
POST /api/publishers (body: {name, name_ar, name_fr, address, city, country, phone, email, website})
PUT /api/publishers/{id}
DELETE /api/publishers/{id}
GET /api/writers?search=
GET /api/writers/{id}
POST /api/writers (body: {name, name_ar, name_fr, nationality, birth_year, death_year, biography})
PUT /api/writers/{id}
DELETE /api/writers/{id}
GET /api/genres
POST /api/genres (body: {name, name_ar, name_fr})
PUT /api/genres/{id}
DELETE /api/genres/{id}
GET /api/lending?status=all|active|overdue|returned
POST /api/lending (body: {book_id, borrower_name, borrower_contact, due_date, notes})
PUT /api/lending/{id} (body: {due_date, notes, borrower_contact})
POST /api/lending/{id}/return
DELETE /api/lending/{id}
GET /api/lending/overdue
GET /api/reports/summary
GET /api/reports/by-genre
GET /api/reports/by-author?limit=20
GET /api/reports/by-year
GET /api/reports/by-location
GET /api/reports/lending-history?from_date=&to_date=
GET /api/reports/export/csv (downloads file)
GET /api/reports/export/pdf (downloads file)
GET /api/users
GET /api/users/{id}
PUT /api/users/{id} (body: {full_name, email, role, is_active})
DELETE /api/users/{id}
POST /api/backup/create
GET /api/backup/list
GET /api/backup/download/{filename}
DELETE /api/backup/{filename}
GET /api/ebook-plugin/status
POST /api/ebook-plugin/enable
POST /api/ebook-plugin/disable
All
/api/ebooks/*endpoints return403if the plugin is disabled.
GET /api/ebooks?search=&format=pdf|epub|mobi&page=1&per_page=24
Response includes publisher_name (joined from publishers table).
GET /api/ebooks/{id}
POST /api/ebooks/upload
Body: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
file |
File | β | PDF, EPUB, or MOBI (max 100 MB) |
title |
string | Override auto-detected title | |
author |
string | Override auto-detected author | |
publisher_id |
UUID | Link to an existing publisher | |
total_pages |
integer | Manual page count |
Response:
{
"message": "E-book uploaded successfully.",
"data": { ...ebook object... },
"metadata_complete": true
}PUT /api/ebooks/{id}
Body (all optional):
{
"title": "New Title",
"author": "Author Name",
"publisher_id": "uuid",
"total_pages": 350,
"notes": ""
}DELETE /api/ebooks/{id}
Also deletes the physical file and cover from storage.
POST /api/ebooks/{id}/progress
Body:
{"current_page": 42}Response:
{
"data": {
"id": "uuid",
"current_page": 42,
"total_pages": 350,
"read_percentage": 12.0
}
}GET /api/ebooks/{id}/open
- PDF:
Content-Disposition: inline(browser opens PDF viewer) - EPUB/MOBI:
Content-Disposition: attachment(browser downloads)
GET /api/ebooks/{id}/cover
Returns the cover image binary (image/jpeg or image/png).
Returns { "cover_url": null, "source": "default" } if no cover has been set.
POST /api/ebooks/{id}/cover
Body: multipart/form-data with field cover (JPEG, PNG, or WEBP, max 5 MB).
POST /api/ebooks/{id}/reextract-cover
Re-renders the first page of the PDF or reads the EPUB manifest cover.
POST /api/ebooks/{id}/refresh-cover
Body (optional β defaults to stored title/author):
{"title": "Search title", "author": "Author name"}{"error": "Error message here."} // Single error (with HTTP status code)
{"errors": ["Field 'x' is required."]} // Validation errors (422)| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 401 | Unauthorized (invalid/expired token) |
| 403 | Forbidden (insufficient role) |
| 404 | Not found |
| 409 | Conflict (duplicate) |
| 422 | Validation error |
| 429 | Rate limited |
| 500 | Server error |
Getting Started
Features
- Book Scanner
- Managing Locations
- Managing Books
- E-Book Plugin
- Publishers & Writers
- Lending System
- Reports & Export
User Guide
Administration
Developer
Release Notes