---
id: GetBook
name: Get book
version: 1.0.0
badges:
  - content: Catalog Management
    backgroundColor: green
    textColor: green
summary: Returns one book and its catalog relationships by identifier.
owners:
  - catalog-experience-team
schemaPath: schema.json
operation:
  method: GET
  path: /api/v1/books/{id}
  statusCodes: ["200", "404"]
sidebar:
  badge: "GET"
---

`GetBook` queries [[service|catalog-api]] (`GET /catalog/api/v1/books/{id}`) to retrieve a single book's full projection, including pricing, stock status, category, publisher, authors, and derived rating summary. The endpoint is publicly readable, supports HTTP `ETag` conditional requests, and caches book details.

## Overview

| Property                           | Value                                                                                                                                                      |
| :--------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bounded Context**                | Catalog                                                                                                                                                    |
| **Owner Service**                  | [[service\|catalog-api]]                                                                                                                                   |
| **Protocol / Format**              | HTTP `GET`, `application/json` response                                                                                                                    |
| **Gateway Endpoint**               | `GET /catalog/api/v1/books/{id}` (service path `/api/v1/books/{id}`)                                                                                       |
| **Authentication & Authorization** | None required (public read endpoint)                                                                                                                       |
| **Idempotency / Concurrency**      | Read-only; supports conditional requests via `ETag` / `If-None-Match` (`304 Not Modified`)                                                                 |
| **Rate Limit / Caching**           | Global concurrency (`100`), per-IP fixed-window (`30 req/min`), and per-user token bucket (`30` limit, `20` per `10s`, queue `5`); cached in L1 + Redis L2 |
| **Contract Version**               | `1.0.0` (`ApiVersions.V1`)                                                                                                                                 |

## Request & Response Contract

### Path Parameters

| Name | Type              | Required | Constraints | Description                               |
| :--- | :---------------- | :------- | :---------- | :---------------------------------------- |
| `id` | `string` (`uuid`) | Yes      | Valid UUID  | Unique identifier of the book to retrieve |

### Success Response (`200 OK`)

Returns a `BookDto` JSON object with an `ETag` response header.

| Name            | Type              | Required | Constraints                                    | Description                                              |
| :-------------- | :---------------- | :------- | :--------------------------------------------- | :------------------------------------------------------- |
| `id`            | `string` (`uuid`) | Yes      | Valid UUID                                     | Unique identifier of the book                            |
| `name`          | `string \| null`  | Yes      | Nullable                                       | Book title                                               |
| `description`   | `string \| null`  | Yes      | Nullable                                       | Book description                                         |
| `imageUrl`      | `string \| null`  | Yes      | URI or `null`                                  | Publicly accessible cover image URI                      |
| `price`         | `number`          | Yes      | Decimal                                        | Regular unit price                                       |
| `priceSale`     | `number \| null`  | Yes      | Decimal or `null`                              | Promotional sale price (`null` when no discount applies) |
| `status`        | `string`          | Yes      | Enum: `InStock`, `OutOfStock`                  | Current stock availability status                        |
| `category`      | `object \| null`  | Yes      | `{ id: uuid, name: string \| null }` or `null` | Assigned book category                                   |
| `publisher`     | `object \| null`  | Yes      | `{ id: uuid, name: string \| null }` or `null` | Assigned publisher                                       |
| `authors`       | `object[]`        | Yes      | Array of `{ id: uuid, name: string \| null }`  | Authors associated with the book                         |
| `averageRating` | `number`          | Yes      | `>= 0`                                         | Derived average customer rating projected from Reviews   |
| `totalReviews`  | `integer`         | Yes      | `>= 0`                                         | Derived total feedback count projected from Reviews      |

## Behavior & Side Effects

- **Read-through caching:** Serves cached book details from L1/Redis L2 and invalidates automatically on book, author, category, publisher, or rating updates.
- **ETag concurrency support:** Returns the book's row version as an `ETag` header for conditional reads (`If-None-Match`) and optimistic concurrency updates via [[command|UpdateBook]].
- **No state mutation:** Pure read query with no database writes or integration events.

## Error Responses

| Status / Code           | Condition                                                 | Client Recovery Action                                   |
| :---------------------- | :-------------------------------------------------------- | :------------------------------------------------------- |
| `304 Not Modified`      | Request included a matching `If-None-Match` ETag header   | Reuse the client's cached book payload                   |
| `404 Not Found`         | No active book exists for the supplied UUID               | Render a not-found state; do not fabricate an empty book |
| `429 Too Many Requests` | Rate limit quota exceeded (`Retry-After` header included) | Wait for the `Retry-After` duration before retrying      |

## Related Documentation

- [[service|catalog-api]] — Service overview, persistence, and endpoints.
- [[entity|book]] — Book entity model.
- [[query|ListBooks]] — Search, filter, and paginate books.
- [[query|GetBookDetailsGrpc]] — Internal gRPC contract returning full book details.
- [[command|UpdateBook]] — Update book details using the `ETag` returned by this query.

<NodeGraph />

<SchemaViewer file="schema.json" title="Get book schema" maxHeight="500" search="true" />


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "GetBookResponse",
	"description": "Book representation returned by the Catalog API.",
	"type": "object",
	"allOf": [
		{
			"type": "object",
			"additionalProperties": false,
			"required": [
				"id",
				"name",
				"description",
				"imageUrl",
				"price",
				"priceSale",
				"status",
				"category",
				"publisher",
				"authors",
				"averageRating",
				"totalReviews"
			],
			"properties": {
				"id": {
					"type": "string",
					"format": "uuid",
					"description": "A UUID identifying the resource."
				},
				"name": {
					"type": ["string", "null"]
				},
				"description": {
					"type": ["string", "null"]
				},
				"imageUrl": {
					"type": ["string", "null"],
					"format": "uri"
				},
				"price": {
					"type": "number"
				},
				"priceSale": {
					"type": ["number", "null"]
				},
				"status": {
					"type": "string",
					"enum": ["InStock", "OutOfStock"]
				},
				"category": {
					"type": ["object", "null"],
					"properties": {
						"id": {
							"type": "string",
							"format": "uuid",
							"description": "A UUID identifying the resource."
						},
						"name": {
							"type": ["string", "null"]
						}
					},
					"required": ["id", "name"]
				},
				"publisher": {
					"type": ["object", "null"],
					"properties": {
						"id": {
							"type": "string",
							"format": "uuid",
							"description": "A UUID identifying the resource."
						},
						"name": {
							"type": ["string", "null"]
						}
					},
					"required": ["id", "name"]
				},
				"authors": {
					"type": "array",
					"items": {
						"type": "object",
						"properties": {
							"id": {
								"type": "string",
								"format": "uuid",
								"description": "A UUID identifying the resource."
							},
							"name": {
								"type": ["string", "null"]
							}
						},
						"required": ["id", "name"]
					}
				},
				"averageRating": {
					"type": "number",
					"minimum": 0
				},
				"totalReviews": {
					"type": "integer",
					"minimum": 0
				}
			}
		}
	]
}
