Overview
Get all books in the system with advanced filtering, sorting, and pagination support. This endpoint retrieves a collection of book aggregates from the Catalog bounded context, applying domain filters and returning DTOs that comply with our anti-corruption layer patterns.
The endpoint respects the read model separation in our CQRS implementation, using dedicated read models optimized for query performance. Results can be filtered by various domain attributes including genre, author, and publication status.
Each book in the returned collection contains core domain properties while maintaining a clear separation between entity identity and value objects according to DDD principles.
Architecture
GET (/api/v1/books)
Query Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
pageIndex | integer | No | 1 | The page number to retrieve (1-based) |
pageSize | integer | No | 10 | Number of items per page |
orderBy | string | No | Name | Property to sort results by. Valid values: Name , OriginalPrice , DiscountPrice , Status |
isDescending | boolean | No | false | Whether to sort results in descending order |
search | string | No | null | Search term to filter books by (uses semantic search) |
minPrice | decimal | No | null | Minimum price filter |
maxPrice | decimal | No | null | Maximum price filter |
categoryId | array[Guid] | No | null | Filter by specific category IDs |
publisherId | array[Guid] | No | null | Filter by specific publisher IDs |
authorIds | array[Guid] | No | null | Filter by specific author IDs |
Examples Usage
Basic
curl -X GET "https://api.bookworm.com/api/v1/books"
With Pagination
curl -X GET "https://api.bookworm.com/api/v1/books?pageIndex=2&pageSize=20"
With Search and Filters
curl -X GET "https://api.bookworm.com/api/v1/books?search=fantasy&minPrice=10&maxPrice=50&categoryId=123e4567-e89b-12d3-a456-426614174000"
With Sorting
curl -X GET "https://api.bookworm.com/api/v1/books?orderBy=Price.OriginalPrice&isDescending=true"
Responses
400 Bad Request
When the request parameters are invalid:
200 OK
Returns a paged result containing the filtered books:
Example Response
{
"pageIndex": 1,
"pageSize": 10,
"totalItems": 20,
"totalPages": 2,
"hasNextPage": true,
"hasPreviousPage": false,
"items": [
{
"id": "0195e692-600b-715e-a17b-b3a8faf4ed07",
"name": "The Great Gatsby",
"description": "A classic novel by F. Scott Fitzgerald.",
"imageUrl": "URL_ADDRESS.com/great-gatsby.jpg",
"price": 10.99,
"discountPrice": 9.99,
"status": "InStock",
"authors": [
{
"id": "0195e692-600b-7290-a47f-982b9d7f15f3",
"name": "F. Scott Fitzgerald"
},
{
"id": "0195e692-600b-7d32-99b0-ae7abd82a863",
"name": "John Smith"
}
],
"category": {
"id": "0195e692-600b-7424-a426-dac7227720fe",
"name": "Fiction"
},
"publisher": {
"id": "0195e692-600b-78b3-9b7f-3e342d9f2815",
"name": "Scribner"
},
"averageRating": 4.5,
"totalReviews": 100
}
]
}
Notes
- The endpoint uses semantic search when a search term is provided
- All filters can be combined to create complex queries
- Results are always paginated to ensure optimal performance
- The response includes metadata about the total number of items and pages
- Books are returned with their related entities (authors, category, publisher) included
No properties match your search
Try a different search term or clear the search to see all properties
Total number of items in the collection
Total number of pages in the collection
The current page number
The number of items per page
Indicates if there are more pages
Indicates if there are previous pages
The unique identifier for the book
The name of the book
The description of the book
The URL of the book's image
The price of the book
The sale price of the book
The status of the book
The unique identifier for the category
The name of the category
The unique identifier for the publisher
The name of the publisher
The unique identifier for the author
The name of the author
The average rating of the book
The total of reviewers of the book
No properties match your search
Try a different search term or clear the search to see all properties