Skip to main content
The Library Management System allows you to browse authors and their information. Administrators can create, update, and delete author records to keep the catalog organized.

Browse authors

You can view all authors in the system with pagination support.
1

Request author list

Make a GET request to /api/authors to retrieve paginated authors:
curl http://localhost:8080/api/authors?page=0&size=20&sort=id
2

Review author listings

The response includes paginated author data:
{
  "success": true,
  "message": null,
  "data": {
    "content": [
      {
        "id": 1,
        "name": "Douglas Crockford"
      },
      {
        "id": 2,
        "name": "Robert C. Martin"
      },
      {
        "id": 3,
        "name": "Martin Fowler"
      }
    ],
    "pageable": {
      "pageNumber": 0,
      "pageSize": 20
    },
    "totalElements": 45,
    "totalPages": 3
  }
}
By default, the author list returns 20 authors per page sorted by ID. You can customize pagination using the page, size, and sort query parameters.

View author details

You can retrieve detailed information about a specific author using their ID.
curl http://localhost:8080/api/authors/1
Response:
{
  "success": true,
  "message": null,
  "data": {
    "id": 1,
    "name": "Douglas Crockford"
  }
}
In future versions, author details may include additional information such as biography, bibliography, and related books.

Add a new author

Author management operations require administrator privileges. Ensure you’re authenticated with an admin account.
Administrators can add new authors to the system for use when cataloging books.
1

Prepare author information

Gather the author’s name. The name should be their full name as it appears on their published works.
2

Send create request

Make a POST request to /api/management/authors with the Authorization header:
curl -X POST http://localhost:8080/api/management/authors \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Kent Beck"
  }'
3

Confirmation

The system returns the newly created author with their assigned ID:
{
  "success": true,
  "message": null,
  "data": {
    "id": 4,
    "name": "Kent Beck"
  }
}

Author creation requirements

  • Name: 2-100 characters, required
Author names must be between 2 and 100 characters long. Ensure the name is spelled correctly as it will appear in book listings.

Update an author

Administrators can update existing author information to correct spelling or update their name.
1

Identify author to update

Get the ID of the author you want to update.
2

Send update request

Make a PUT request to /api/management/authors/{id}:
curl -X PUT http://localhost:8080/api/management/authors/4 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Kent M. Beck"
  }'
3

Review updated author

The system returns the updated author information:
{
  "success": true,
  "message": null,
  "data": {
    "id": 4,
    "name": "Kent M. Beck"
  }
}
Updating an author’s name automatically updates their name in all books they’ve written.

Delete an author

Administrators can remove authors from the system when they’re no longer needed.
1

Check for associated books

Before deleting an author, ensure they’re not associated with any books in the catalog.
You cannot delete an author who is associated with books. Remove the author from all books first, or delete the books.
2

Send delete request

Make a DELETE request to /api/management/authors/{id}:
curl -X DELETE http://localhost:8080/api/management/authors/4 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
3

Confirmation

The system confirms the deletion:
{
  "success": true,
  "message": "Author deleted successfully",
  "data": null
}

Using authors in book management

When creating or updating books, you reference authors by their ID:
{
  "isbn": "978-0-13-468599-1",
  "title": "Clean Code",
  "description": "A handbook of agile software craftsmanship",
  "coverImageUrl": "https://example.com/covers/clean-code.jpg",
  "authorIds": [2, 4],
  "categoryId": 1
}
In this example, the book has two authors with IDs 2 and 4.

Related workflows

Learn how to create and manage books with authors

Author workflow best practices

Follow these best practices when managing authors:
1

Create authors first

Before adding books to your catalog, create the author records you’ll need. This makes book creation faster and more efficient.
2

Use consistent naming

Be consistent with how you format author names. Decide whether to use full names, initials, or pseudonyms and stick to that format.
3

Check for duplicates

Before creating a new author, search the existing author list to ensure you’re not creating a duplicate record.
4

Handle multiple authors

When a book has multiple authors, include all author IDs in the authorIds array when creating or updating the book.

Common author management errors

You may encounter these errors when managing authors:
  • Author not found: The specified author ID doesn’t exist in the database
  • Duplicate author name: An author with this exact name already exists
  • Author in use: Cannot delete this author because they’re associated with one or more books
  • Invalid name length: The author name must be between 2 and 100 characters
  • Unauthorized: You must be an administrator to manage authors
If you need to delete an author who is associated with books, you have two options: update those books to remove the author association, or delete the books first.

Build docs developers (and LLMs) love