Update book
Updates an existing book listing, including optional image and catalog relationships.
/api/v1/booksUpdateBook replaces the full metadata, pricing, relationships, and optional cover image of an existing book in Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid
discovery, and authoritative book metadata.
PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs (PUT /catalog/api/v1/books) from a multipart/form-data payload and returns 204 No Content. Callers can supply an If-Match header with the book’s ETag to enforce optimistic concurrency control.
Overview
| Property | Value |
|---|---|
| Bounded Context | Catalog |
| Owner Service | Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs |
| Protocol / Format | HTTP PUT, multipart/form-data request, empty response (204 No Content) |
| Gateway Endpoint | PUT /catalog/api/v1/books (service path /api/v1/books) |
| Authentication & Authorization | Microsoft Entra ID JWT — business_user policy (role business_user or admin and scopes catalog_read, catalog_write) |
| Idempotency / Concurrency | Optional If-Match ETag header for optimistic concurrency (412 Precondition Failed on mismatch); idempotent when resubmitting identical fields without a new image upload |
| Rate Limit / Caching | Global concurrency (100) and fixed-window (30 req/min) limiters plus per-user token bucket; invalidates book, summary, list, and search caches |
| Contract Version | 1.0.0 (ApiVersions.V1) |
PUT /catalog/api/v1/books is a full replacement, not a partial patch. Every request requires id, name, price, categoryId, publisherId, and authorIds; omitting optional fields (description, priceSale) overwrites them with their defaults ("" and null).
Request & Response Contract
Request Headers
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer <access-token> | Entra ID JWT satisfying the business_user policy |
If-Match | string | No | Strong ("<row-version>") or weak (W/"<row-version>") unsigned integer ETag from Get bookQueryv1.0.0Get bookReturns one book and its catalog relationships by identifier.Ownercatalog-experience-teamSchemaDiagramOpen docs | Expected row version for optimistic concurrency control |
Request Form Fields (multipart/form-data)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
id | string (uuid) | Yes | Non-empty UUID | Identifier of the book to replace |
name | string | Yes | Non-empty, max 50 characters | Book title |
description | string | No | Default "", max 500 characters | Book summary text; omitting clears the stored description |
price | number | Yes | Strictly > 0 (numeric(18,2)) | Regular catalog price |
priceSale | number | null | No | When provided: strictly > 0 and <= price | Optional promotional sale price; omitting clears any existing sale price |
categoryId | string (uuid) | Yes | Non-empty UUID; must reference an existing category | Category identifier |
publisherId | string (uuid) | Yes | Non-empty UUID; must reference an existing publisher | Publisher identifier |
authorIds | string[] (uuid[]) | Yes | Non-empty array (>= 1 UUID); repeat authorIds form fields for multiple authors | Complete replacement list of author identifiers |
image | string (binary) | No | Max 1,048,576 bytes (1 MB); image/jpeg (.jpg, .jpeg), image/png (.png), or image/webp (.webp); extension must match content type | Optional cover image upload replacing the stored cover URN |
isRemoveImage | boolean | No | Default false | When true, clears the stored cover image reference (takes precedence over image) |
Behavior & Side Effects
- Optimistic concurrency: When
If-Matchcontains a valid integer ETag, it is checked against the book’s current row version; mismatches return412 Precondition Failed. - Transactional persistence: Atomically replaces book fields and author associations within a database transaction.
- Cover image handling: Uploading
imagestores a new blob incatalog-bloband updates the book’s image URN; omitting bothimageandisRemoveImage=truepreserves the existing cover; settingisRemoveImage=trueclears the stored image reference in PostgreSQL without deleting previously stored blobs. - Cache invalidation: Clears cached book details (
book:{id}), book summary (book:summary:{id}), and invalidatesbooks:listandbooks:searchcache tags. - Vector index queueing: Database triggers enqueue the book ID for asynchronous Qdrant embedding refresh by Catalog IngestionServicev1.0.0Catalog IngestionInternal background worker that reads pending Catalog book updates and synchronizes semantic search vectors in Qdrant. SubscribesProcessVectorBatchIntegrationEventOwnercatalog-experience-teamDiagramRepositoryOpen docs.
Error Responses
| Status / Code | Condition | Client Recovery Action |
|---|---|---|
400 Bad Request | Validation failure (missing required fields, price <= 0, priceSale <= 0 or > price, length exceeded, invalid image size/type/extension) or malformed multipart payload | Fix invalid form fields or file upload; do not retry unchanged input |
401 Unauthorized | Missing, expired, or invalid Entra ID JWT | Acquire a valid Entra ID access token and retry |
403 Forbidden | Token lacks role business_user or admin, or lacks scopes catalog_read and catalog_write | Request the required Entra ID app role and scopes |
404 Not Found | No active book exists with the supplied id | Verify the book UUID; do not treat 404 as a completed update |
412 Precondition Failed | If-Match version does not match the book’s current row version | Fetch the latest book and ETag via Get bookQueryv1.0.0Get bookReturns one book and its catalog relationships by identifier.Ownercatalog-experience-teamSchemaDiagramOpen docs, merge changes, and retry |
429 Too Many Requests | Rate limit quota exceeded (Retry-After header included) | Wait for the Retry-After interval before retrying |
500 Internal Server Error | Foreign-key violation, blob storage failure, or unhandled server error (traceId included) | Verify referenced IDs exist and inspect service logs using traceId |
Related Documentation
- Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid discovery, and authoritative book metadata. PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs — Service overview, routing, and authorization policies.
- BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs — Book entity model.
- Create bookCommandv1.0.0Create bookCreates a book listing and returns its generated UUID.Ownercatalog-experience-teamSchemaDiagramOpen docs — Create a new book listing with multipart upload.
- Delete bookCommandv1.0.0Delete bookDeletes an existing book from the Catalog.Ownercatalog-experience-teamSchemaDiagramOpen docs — Soft-delete an existing book listing.
- Get bookQueryv1.0.0Get bookReturns one book and its catalog relationships by identifier.Ownercatalog-experience-teamSchemaDiagramOpen docs — Retrieve current book details and
ETag.
Update book schema
Multipart payload for updating a book listing.
not allowedBook UUID to update.
100A UUID identifying the resource.
A UUID identifying the resource.
Remove the existing cover when true.