Skip to main content
GET
/
api
/
books
/
{id}
Get Book
curl --request GET \
  --url https://api.example.com/api/books/{id}
{
  "success": true,
  "data": {
    "id": 123,
    "isbn": "<string>",
    "title": "<string>",
    "description": "<string>",
    "coverImageUrl": "<string>",
    "authors": [
      {
        "id": 123,
        "name": "<string>"
      }
    ],
    "category": {
      "id": 123,
      "name": "<string>"
    }
  },
  "message": "<string>"
}

Endpoint

GET /api/books/{id}
Retrieves detailed information about a specific book.

Authentication

This endpoint is publicly accessible and does not require authentication.

Path Parameters

id
long
required
The unique identifier of the book to retrieve

Response

success
boolean
required
Indicates if the request was successful
data
object
required
The book object
id
long
Unique identifier for the book
isbn
string
International Standard Book Number in normalized format (all hyphens and spaces removed)
title
string
Book title
description
string
Detailed book description (max 1000 characters)
coverImageUrl
string
URL to the book’s cover image
authors
array
Array of author objects (many-to-many relationship)
id
long
Author’s unique identifier
name
string
Author’s name
category
object
Category object the book belongs to
id
long
Category’s unique identifier
name
string
Category name
message
string
Optional message (usually null on success)

Example Request

curl -X GET "http://localhost:8080/api/books/1"

Example Response

{
  "success": true,
  "data": {
    "id": 1,
    "isbn": "9780134685991",
    "title": "Effective Java",
    "description": "A comprehensive guide to Java programming best practices and design patterns. This third edition covers Java 7, 8, and 9, including new features like lambdas, streams, and modules.",
    "coverImageUrl": "https://example.com/covers/effective-java.jpg",
    "authors": [
      {
        "id": 1,
        "name": "Joshua Bloch"
      }
    ],
    "category": {
      "id": 2,
      "name": "Programming"
    }
  },
  "message": null
}

Error Responses

Book Not Found (404)

{
  "success": false,
  "data": null,
  "message": "Book not found with id: 999"
}

Notes

  • The ISBN is stored in normalized format (all non-numeric characters except ‘X’ are removed)
  • Books have a many-to-many relationship with authors - a book can have multiple authors
  • Each book belongs to exactly one category (many-to-one relationship)
  • The coverImageUrl field may be null if no cover image is available
  • Source: BookController.java:29-32

Build docs developers (and LLMs) love