http://<192.168.181.247:80>/
This document describes the structure of a Book object as returned by the backend API in different levels of detail, based on flags such as full and holders.
{
"id": "integer",
"isTaken": "boolean",
"quantity": "integer",
"book_name": "string",
"category": "string"
}id: Unique identifier for the bookisTaken: Whether the book is currently taken (i.e., unavailable)quantity: Number of available copiesbook_name: The title of the bookcategory: The book's main category
{
"holders": [ { ...user object... } ]
}holders: A list of users currently holding the book. Each holder is serialized using theirtoJson()method.
{
"series": "string | null",
"series_index": "integer | null",
"author": "string | null",
"sub_category": "string | null",
"sub_category_index": "integer | null",
"description": "string | null",
"notes": "string | null",
"librarian_notes": "string | null"
}-
Endpoint:
POST /book/add -
Query Parameters (optional):
series,series_index,author,sub_cat,sub_cat_index,quantity,description,notes,librarian_notes
-
Request Body:
{ "book_name": "string", "category": "string" } -
Response:
{ "message": "updated bookDB", "Book": { ...book details... } full - β , holders - β }
-
Endpoint:
GET /book/<book_name> -
Response:
{ "books": [ { ...all books with book_name... } ] full - β, holders - β }
-
Endpoint:
GET /book/id/<id> -
Response:
{ "book": { ...full book details... } full - β , holders - β }
-
Endpoint:
GET /book/all -
Response:
[ { ...first db book... }, { ...seconds db book... }, ... ] full - β , holders - β
{
"id": "integer",
"username": "string",
"display_name": "string",
"permission": "string",
"held_books": [{ ...book details... }]
}-
Endpoint:
POST /user/signup -
Request Body:
{ "username": "string", "display_name": "string", "password": "string" } -
Response:
{ "message": "User created", "user": { ...user json... } }
- Endpoint:
POST /user/signup-admin - Request Body: same as
/client/signup - Permission Level: Admin
-
Endpoint:
POST /user/login -
Request Body:
{ "username": "string", "password": "string" } -
Response:
{ "message": "Logged in", "user": { ...user json... } }
-
Endpoint:
GET /user/<username> -
Response:
{ ...user json... }
-
Endpoint:
GET /user/id/<id> -
Response:
{ ...user json... }
-
Endpoint:
GET /user/id/<client_id>/holding -
Response:
{ "client": { ...client json... }, "books": [ { ...held books json... } ] }
-
Endpoint:
GET /user/all -
Response:
[ { ...all users json... }, ... ]
-
Endpoint:
POST /library/user/id/<client_id>/obtain -
Request Body:
{ "book_id": <book_id> } -
Response:
{ "message": "book obtained by user", "book": { ...book json... }, "user": { ...client json... } }
-
Endpoint:
POST /library/user/id/<client_id>/return -
Request Body:
{ "book_id": <book_id> } -
Response:
{ "message": "book returned from user", "book": { ...book json... }, "user": { ...client json... } }
- 400 Bad Request: Missing or invalid fields
- 404 Not Found: Book or user does not exist
- 409 Conflict: Resource already exists
- 200 OK / 201 Created: Successful operation