library-rest

Get a single book by id.

GET/books/{id}

Returns the book matching the given id.

Parameters

NameInTypeRequiredDescription
idpathstringyesThe book's unique identifier.

Responses

200 The requested book.

application/json

FieldTypeRequiredDescription
dataobjectyesA single library title.
authorIdstringyesThe id of the Author who wrote this book.
createdAtstring (date-time)yesWhen the book record was created.
idstringyesUnique identifier assigned by the server, prefixed with bk_.
isbnstringyesThe book's ISBN. Must be unique across the catalog.
publishedYearintegeryesThe year the book was first published. Must be between 1450 and next year.
statusstringyesA book's availability. borrowed means it is out on an open loan. Allowed values: available, borrowed
titlestringyesThe book's display title, 1–200 characters.
updatedAtstring (date-time)yesWhen the book record was last modified.
metaobjectyesResponse metadata attached to every successful response.
requestIdstringyesCorrelation id for this request, echoed from the X-Request-Id request header or generated if absent. Useful for tracing a request across logs.
totalintegerTotal number of matches before pagination was applied. Present only on paginated list responses (currently GET /books).

Errors

CodeMessageDescription
401The request is missing a valid Authorization: Bearer <token> header.
404No resource exists with the given id.
500An unexpected error occurred. The response never leaks internal error details.

Response example

{
  "data": {
    "authorId": "authorId_952",
    "createdAt": "createdAt_833",
    "id": "id_546",
    "isbn": "isbn_830",
    "publishedYear": 779,
    "status": "borrowed",
    "title": "title_267",
    "updatedAt": "updatedAt_530"
  },
  "meta": {
    "requestId": "requestId_122",
    "total": 778
  }
}