Skip to main content
GET
/
authors
List Authors
curl --request GET \
  --url https://api.example.com/authors
{
  "200": {},
  "401": {},
  "content": [
    {
      "id": 123,
      "name": "<string>",
      "age": 123
    }
  ],
  "pageable": {
    "pageNumber": 123,
    "pageSize": 123,
    "offset": 123
  },
  "totalPages": 123,
  "totalElements": 123,
  "last": true,
  "first": true,
  "size": 123,
  "number": 123,
  "numberOfElements": 123,
  "empty": true
}
Retrieves a paginated list of all authors in the library system.

Authentication

This endpoint requires HTTP Basic Authentication.

Query Parameters

page
integer
default:"0"
The page number to retrieve (zero-based)
size
integer
default:"20"
The number of items per page
sort
string
Sort criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.Example: name,asc or age,desc

Response

The response is a paginated object containing an array of authors.
content
array
Array of author objects
id
long
The unique identifier of the author
name
string
The name of the author
age
integer
The age of the author
pageable
object
Pagination information
pageNumber
integer
Current page number (zero-based)
pageSize
integer
Number of items per page
offset
long
Offset of the current page
totalPages
integer
Total number of pages
totalElements
long
Total number of authors
last
boolean
Whether this is the last page
first
boolean
Whether this is the first page
size
integer
Number of items in the current page
number
integer
Current page number (zero-based)
numberOfElements
integer
Number of elements in the current page
empty
boolean
Whether the page is empty

Status Codes

200
OK
Authors successfully retrieved
401
Unauthorized
Authentication credentials are missing or invalid

Example Request

curl -X GET "http://localhost:8080/authors?page=0&size=10&sort=name,asc" \
  -u username:password

Example Response

{
  "content": [
    {
      "id": 1,
      "name": "George Orwell",
      "age": 46
    },
    {
      "id": 2,
      "name": "J.K. Rowling",
      "age": 58
    }
  ],
  "pageable": {
    "pageNumber": 0,
    "pageSize": 10,
    "offset": 0
  },
  "totalPages": 1,
  "totalElements": 2,
  "last": true,
  "first": true,
  "size": 10,
  "number": 0,
  "numberOfElements": 2,
  "empty": false
}

Build docs developers (and LLMs) love