library-rest

Get a single author, with their full books nested.

GET/authors/{id}

Returns the author matching the given id, together with the full Book records (not just ids) for every book they have written.

Parameters

NameInTypeRequiredDescription
idpathstringyesThe author's unique identifier.

Responses

200 The requested author, with nested books.

application/json

FieldTypeRequiredDescription
dataobjectyesAn author with their full book records nested, as returned by GET /authors/{id}.
biostringyesA short biography of the author.
booksarray of objectyesThe full Book records this author has written.
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.
idstringyesUnique identifier assigned by the server, prefixed with au_.
namestringyesThe author's full name.
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": {
    "bio": "bio_339",
    "books": [
      {
        "authorId": "authorId_902",
        "createdAt": "createdAt_221",
        "id": "id_400",
        "isbn": "isbn_891",
        "publishedYear": 595,
        "status": "borrowed",
        "title": "title_922",
        "updatedAt": "updatedAt_517"
      }
    ],
    "id": "id_495",
    "name": "name_801"
  },
  "meta": {
    "requestId": "requestId_98",
    "total": 359
  }
}