Skip to main content
POST
/
authors
Create Author
curl --request POST \
  --url https://api.example.com/authors \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "age": 123
}
'
{
  "201": {},
  "401": {},
  "id": 123,
  "name": "<string>",
  "age": 123
}
Creates a new author in the library system.

Authentication

This endpoint requires HTTP Basic Authentication.

Request Body

name
string
required
The name of the author
age
integer
The age of the author

Response

id
long
The unique identifier of the created author
name
string
The name of the author
age
integer
The age of the author

Status Codes

201
Created
Author successfully created
401
Unauthorized
Authentication credentials are missing or invalid

Example Request

curl -X POST http://localhost:8080/authors \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{
    "name": "J.K. Rowling",
    "age": 58
  }'

Example Response

{
  "id": 1,
  "name": "J.K. Rowling",
  "age": 58
}

Build docs developers (and LLMs) love