library-rest
Create a new author.
POST
/authorsCreates an author with no books linked yet. Books are linked to it via POST /books.
Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
| bio | string | A short biography of the author. Optional. | |
| name | string | yes | The author's full name. Must not be blank. |
Responses
201 The author was created.
application/json
| Field | Type | Required | Description |
|---|---|---|---|
| data | object | yes | A book author, referencing the books they have written by id. |
| bio | string | yes | A short biography of the author. |
| bookIds | array of string | yes | Ids of the books this author has written. |
| 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 |
|---|---|---|
| 400 | The request body is not valid JSON. | |
| 401 | The request is missing a valid Authorization: Bearer <token> header. | |
| 415 | The request has a body but its Content-Type is not application/json. | |
| 422 | name is missing or blank. | |
| 500 | An unexpected error occurred. The response never leaks internal error details. |
Request example
{
"bio": "bio_725",
"name": "name_222"
}Response example
{
"data": {
"bio": "bio_61",
"bookIds": [
"bookIds_92"
],
"id": "id_519",
"name": "name_97"
},
"meta": {
"requestId": "requestId_120",
"total": 883
}
}