GET /v2/books endpoint no longer supports the sort=title parameter. Replace it with sort=createdDate or implement client-side sorting.
Prerequisites
Before you begin, ensure you meet the following prerequisites:- Familiarity with BookHub Publisher API v1.
- Access to your codebase that integrates with the BookHub Publisher API.
- A valid JWT for authentication.
Step 1: Audit your codebase for sort=title parameters
sort=title or sort.*title appears.
Step 2: Replace with sort=createdDate or client-side sorting
To update your code, replace any instances of sort=title with either sort=createdDate or client-side sorting. Option A uses the API’s sort=createdDate parameter to return results pre-sorted. Option B fetches unsorted results and sorts them in your application code. Here are examples of both approaches:
Before (v1)
After (v2) option A: sort=createdDate (recommended)
After (v2) option B: client-side sorting
When fetching books, you can sort them by title on the client side after retrieving the data. Here’s an example of how to do this in Python:This example fetches up to 100 books in a single request. For catalogs larger than 100 books, paginate through all pages before sorting. See Handle pagination for details.
Response
A successfulGET /v2/books request using sort=createdDate returns 200 OK:
order=desc returns books newest first, order=asc for oldest first.
See Get all books for all available parameter values.
Step 3: Verify your changes
Send a test request and confirm the response returns200 OK with books ordered by createdDate. For catalogs larger than 100 books, run the pagination test from Handle pagination to verify all pages return correctly.
createdDate.
If your code still passes sort=title, v2 returns a 400 error:
Error handling
Next steps
Explore related topics:How-to guides
- Migrate to BookHub Publisher API v2 — Update your code to use BookHub Publisher API v2’s new features.
Reference
- Release notes — Explore all changes in BookHub Publisher API v2.
- Breaking changes in v2 — Details all breaking changes in v2 of the BookHub Publisher API.
- API endpoints — Provides additional information about the BookHub Publisher API v2 endpoints, including business rules.
- Code examples — Copy code samples for book creation, sorting by creation date, handling removed title sorting, and tracking performance with
hitCount.