Skip to main content
GET
/
api
/
authors
List Authors
curl --request GET \
  --url https://api.example.com/api/authors
{
  "success": true,
  "timestamp": "<string>",
  "data": {
    "content": [
      {
        "id": 123,
        "name": "<string>"
      }
    ],
    "pageable": {
      "pageNumber": 123,
      "pageSize": 123,
      "offset": 123
    },
    "totalPages": 123,
    "totalElements": 123,
    "last": true,
    "first": true,
    "numberOfElements": 123,
    "empty": true
  }
}

Endpoint

GET /api/authors

Authentication

Requires authentication with a valid Bearer token.

Query Parameters

page
integer
default:"0"
Page number (zero-indexed)
size
integer
default:"20"
Number of items per page
sort
string
default:"id"
Sort field and direction (e.g., id,asc or name,desc)

Response

success
boolean
required
Indicates if the request was successful
timestamp
string
required
ISO 8601 timestamp of the response
data
object
required
Paginated author data
content
array
required
Array of author objects
id
long
required
Unique identifier for the author
name
string
required
Full name of the author
pageable
object
required
Pagination information
pageNumber
integer
required
Current page number (zero-indexed)
pageSize
integer
required
Number of items per page
offset
long
required
Offset of the first item in the current page
totalPages
integer
required
Total number of pages
totalElements
long
required
Total number of authors
last
boolean
required
Whether this is the last page
first
boolean
required
Whether this is the first page
numberOfElements
integer
required
Number of elements in the current page
empty
boolean
required
Whether the page is empty

Example Request

curl -X GET "http://localhost:8080/api/authors?page=0&size=10&sort=name,asc" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Example Response

{
  "success": true,
  "timestamp": "2026-03-03T10:00:00Z",
  "data": {
    "content": [
      {
        "id": 1,
        "name": "George Orwell"
      },
      {
        "id": 2,
        "name": "J.K. Rowling"
      },
      {
        "id": 3,
        "name": "Stephen King"
      }
    ],
    "pageable": {
      "pageNumber": 0,
      "pageSize": 10,
      "offset": 0
    },
    "totalPages": 1,
    "totalElements": 3,
    "last": true,
    "first": true,
    "numberOfElements": 3,
    "empty": false
  }
}

Error Responses

401 Unauthorized

{
  "success": false,
  "timestamp": "2026-03-03T10:00:00Z",
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}

Build docs developers (and LLMs) love