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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | string | yes | The author's unique identifier. |
Responses
200 The requested author, with nested books.
application/json
| Field | Type | Required | Description |
|---|---|---|---|
| data | object | yes | An author with their full book records nested, as returned by GET /authors/{id}. |
| bio | string | yes | A short biography of the author. |
| books | array of object | yes | The full Book records this author has written. |
| authorId | string | yes | The id of the Author who wrote this book. |
| createdAt | string (date-time) | yes | When the book record was created. |
| id | string | yes | Unique identifier assigned by the server, prefixed with bk_. |
| isbn | string | yes | The book's ISBN. Must be unique across the catalog. |
| publishedYear | integer | yes | The year the book was first published. Must be between 1450 and next year. |
| status | string | yes | A book's availability. borrowed means it is out on an open loan. Allowed values: available, borrowed |
| title | string | yes | The book's display title, 1–200 characters. |
| updatedAt | string (date-time) | yes | When the book record was last modified. |
| id | string | yes | Unique identifier assigned by the server, prefixed with au_. |
| name | string | yes | The author's full name. |
| meta | object | yes | Response metadata attached to every successful response. |
| requestId | string | yes | Correlation id for this request, echoed from the X-Request-Id request header or generated if absent. Useful for tracing a request across logs. |
| total | integer | Total number of matches before pagination was applied. Present only on paginated list responses (currently GET /books). |
Errors
| Code | Message | Description |
|---|---|---|
| 401 | The request is missing a valid Authorization: Bearer <token> header. | |
| 404 | No resource exists with the given id. | |
| 500 | An 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
}
}