Skip to main content
PATCH
/
books
/
{isbn}
Partial Update Book
curl --request PATCH \
  --url https://api.example.com/books/{isbn} \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "author": {
    "author.id": 123,
    "author.name": "<string>",
    "author.age": 123
  },
  "stock": 123,
  "coverImage": "<string>"
}
'
{
  "isbn": "<string>",
  "title": "<string>",
  "author": {
    "author.id": 123,
    "author.name": "<string>",
    "author.age": 123
  },
  "stock": 123,
  "coverImage": "<string>"
}
Partially update an existing book by ISBN. Unlike the PUT endpoint, this allows you to update only specific fields without providing the entire book object.

Authentication

This endpoint requires HTTP Basic Authentication.

Path Parameters

isbn
string
required
The ISBN of the book to update.

Request Body

All fields are optional. Only include the fields you want to update.
title
string
The title of the book.
author
object
The author information for the book.
author.id
integer
The unique identifier of the author.
author.name
string
The name of the author.
author.age
integer
The age of the author.
stock
integer
The number of copies available in stock.
coverImage
string
URL or path to the book’s cover image.

Response

isbn
string
The ISBN of the book.
title
string
The title of the book.
author
object
The author information.
author.id
integer
The unique identifier of the author.
author.name
string
The name of the author.
author.age
integer
The age of the author.
stock
integer
The number of copies available in stock.
coverImage
string
URL or path to the book’s cover image. Only included if set.

Status Codes

  • 200 OK: Book was successfully updated
  • 404 Not Found: Book with the specified ISBN does not exist
  • 401 Unauthorized: Authentication credentials are missing or invalid

Example Request

Update only the stock quantity:
curl -X PATCH https://api.example.com/books/978-0-7475-3269-9 \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{
    "stock": 20
  }'
Update multiple fields:
curl -X PATCH https://api.example.com/books/978-0-7475-3269-9 \
  -u username:password \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Harry Potter and the Philosopher Stone (Updated Edition)",
    "stock": 25,
    "coverImage": "https://example.com/covers/hp1-updated.jpg"
  }'

Example Response

{
  "isbn": "978-0-7475-3269-9",
  "title": "Harry Potter and the Philosopher Stone (Updated Edition)",
  "author": {
    "id": 1,
    "name": "J.K. Rowling",
    "age": 58
  },
  "stock": 25,
  "coverImage": "https://example.com/covers/hp1-updated.jpg"
}

Notes

  • PUT vs PATCH: Use PUT when you want to replace the entire book resource (all fields required). Use PATCH when you want to update only specific fields.
  • The book must exist before you can perform a partial update. If it doesn’t exist, you’ll receive a 404 error.
  • Only the fields included in the request body will be updated. All other fields will retain their existing values.
  • To update the author, you can provide partial author information as well.

Build docs developers (and LLMs) love