LibroRed API (1.0)

Download OpenAPI specification:Download

REST API for LibroRed - Web Application for Book Lending Between Individuals

Authentication

JWT authentication API

User login

Authenticate user and return JWT token

Request Body schema: application/json
email
required
string
password
required
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string"
}

Refresh JWT token

Refresh an existing JWT token

Request Body schema: application/json
refreshToken
required
string

Responses

Request samples

Content type
application/json
{
  • "refreshToken": "string"
}

User logout

Logout user and invalidate JWT token

Responses

User Management

User account management API

Verify current password

Verify user's current password for account changes

Request Body schema: application/x-www-form-urlencoded
currentPassword
required
string

Responses

Update username

Update authenticated user's username

Request Body schema: application/x-www-form-urlencoded
newUsername
required
string

Responses

Update password

Update authenticated user's password

Request Body schema: application/x-www-form-urlencoded
currentPassword
required
string
newPassword
required
string

Responses

Users

User management API

Get all users

Retrieve a list of all users

Responses

Create a new user

Create a new user account

Request Body schema: application/json
id
integer <int64>
username
string
email
string
role
string
Enum: "ROLE_USER" "ROLE_ADMIN"

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "username": "string",
  • "email": "string",
  • "role": "ROLE_USER"
}

Get user by ID

Retrieve a specific user by their ID

path Parameters
id
required
integer <int64>

User ID

Responses

Update user

Update an existing user

path Parameters
id
required
integer <int64>

User ID

Request Body schema: application/json
id
integer <int64>
username
string
email
string
role
string
Enum: "ROLE_USER" "ROLE_ADMIN"

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "username": "string",
  • "email": "string",
  • "role": "ROLE_USER"
}

Delete user

Delete a user by ID

path Parameters
id
required
integer <int64>

User ID

Responses

Books

Book management API

Get all books

Retrieve a list of all books

Responses

Create a new book

Create a new book entry

Request Body schema: application/json
id
integer <int64>
title
string
author
string
genre
string
Enum: "Fiction" "Non_Fiction" "Mystery_Thriller" "SciFi_Fantasy" "Romance" "Historical_Fiction" "Horror"
description
string
hasCoverImage
boolean
object (UserBasicDTO)

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "title": "string",
  • "author": "string",
  • "genre": "Fiction",
  • "description": "string",
  • "hasCoverImage": true,
  • "owner": {
    }
}

Get books with pagination

Retrieve paginated list of books with optional filtering

query Parameters
page
integer
Default: 0

Page number (0-based)

size
integer
Default: 6

Page size

genre
string

Filter by genre

search
string

Search term for title or author

Responses

Create a new book

Create a new book entry (authenticated users only)

Request Body schema: multipart/form-data
title
required
string
author
required
string
genre
required
string
Enum: "Fiction" "Non_Fiction" "Mystery_Thriller" "SciFi_Fantasy" "Romance" "Historical_Fiction" "Horror"
description
string
coverImage
string <binary>

Responses

Get book cover image

Retrieve book cover image by book ID

path Parameters
id
required
integer <int64>

Book ID

Responses

Get books count per genre

Retrieve statistics of books per genre

Responses

Loans

Loan management API

Get valid borrowers for authenticated user

Get list of users who can borrow from the authenticated user

Responses

Get all loans

Retrieve a list of all loans

Responses

Create a new loan

Create a new loan entry

Request Body schema: application/json
id
integer <int64>
object (BookBasicDTO)
object (UserBasicDTO)
object (UserBasicDTO)
startDate
string <date>
endDate
string <date>
status
string
Enum: "Active" "Completed"

Responses

Request samples

Content type
application/json
{
  • "id": 0,
  • "book": {
    },
  • "lender": {
    },
  • "borrower": {
    },
  • "startDate": "2019-08-24",
  • "endDate": "2019-08-24",
  • "status": "Active"
}