Skip to main content
You can use GET /v2/books/{bookId} endpoint to return ETag and Cache-Control headers you need to cache book details and reduce unnecessary API calls.

Prerequisites

Before you begin, ensure you meet the following prerequisites:
  • Familiarity with BookHub Publisher API v2.
  • A valid JWT for authentication.
  • A bookId for the book whose details you want to cache. In Python examples, the bookId is assigned to a book_id variable following Python naming conventions. When you create a book (POST /v2/books), it create a bookId and displays it in the 201 Created response. If you don’t know the bookId, you can find it using the (GET /v2/books).
  • Access to your codebase that integrates with the BookHub Publisher API v2.

Step 1: Make an initial request

Send a GET request to retrieve book details. The response includes an ETag header with a unique identifier for the current version of the resource, and a Cache-Control header indicating how long the response can be cached.
The examples in this document use 123e4567-e89b-41d4-a716-426614174000) as the bookId in the cURL examples and book_id in the Python examples.

Response headers

Step 2: Use ETag for conditional requests

For subsequent requests, include the If-None-Match header with the ETag value from Step 1. If the book details haven’t changed, the server returns 304 Not Modified. 304 means use your stored data. If they have changed, the server returns a 200 OK with updated details.

Step 3: Test your implementation

Send an initial request and store the ETag; then send a second conditional request with the ETag from the initial request, including the If-None-Match header. Confirm the second request returns 304 Not Modified if the book details haven’t changed.

Initial request

Conditional request

The second request should return 304 Not Modified if the book details haven’t changed.

Response

A 304 Not Modified response returns no headers beyond the standard HTTP response headers — no body is returned. The Cache-Control: max-age=3600, must-revalidate header in the initial response means the cached data is valid for 3600 seconds (one hour). After expiry, the cache must revalidate with the server before serving the cached response. A 200 OK response returns updated book details:

Error handling

Next steps

Explore related topics:

How-to guides

Reference

  • Get a specific book — Explore all available API endpoints and their parameters for BookHub Publisher API v2.
  • Data models — Explore schema definitions for BaseBook, BookWithAnalytics, Pagination, and Error response objects in the BookHub Publisher API v2.

Last modified on July 25, 2026