Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Update book

Updates an existing book listing, including optional image and catalog relationships.

Catalog Management
PUT/api/v1/books

UpdateBook 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

PropertyValue
Bounded ContextCatalog
Owner ServiceCatalog 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 / FormatHTTP PUT, multipart/form-data request, empty response (204 No Content)
Gateway EndpointPUT /catalog/api/v1/books (service path /api/v1/books)
Authentication & AuthorizationMicrosoft Entra ID JWT — business_user policy (role business_user or admin and scopes catalog_read, catalog_write)
Idempotency / ConcurrencyOptional If-Match ETag header for optimistic concurrency (412 Precondition Failed on mismatch); idempotent when resubmitting identical fields without a new image upload
Rate Limit / CachingGlobal concurrency (100) and fixed-window (30 req/min) limiters plus per-user token bucket; invalidates book, summary, list, and search caches
Contract Version1.0.0 (ApiVersions.V1)
Note

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

NameTypeRequiredConstraintsDescription
AuthorizationstringYesBearer <access-token>Entra ID JWT satisfying the business_user policy
If-MatchstringNoStrong ("<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 docsExpected row version for optimistic concurrency control

Request Form Fields (multipart/form-data)

NameTypeRequiredConstraintsDescription
idstring (uuid)YesNon-empty UUIDIdentifier of the book to replace
namestringYesNon-empty, max 50 charactersBook title
descriptionstringNoDefault "", max 500 charactersBook summary text; omitting clears the stored description
pricenumberYesStrictly > 0 (numeric(18,2))Regular catalog price
priceSalenumber | nullNoWhen provided: strictly > 0 and <= priceOptional promotional sale price; omitting clears any existing sale price
categoryIdstring (uuid)YesNon-empty UUID; must reference an existing categoryCategory identifier
publisherIdstring (uuid)YesNon-empty UUID; must reference an existing publisherPublisher identifier
authorIdsstring[] (uuid[])YesNon-empty array (>= 1 UUID); repeat authorIds form fields for multiple authorsComplete replacement list of author identifiers
imagestring (binary)NoMax 1,048,576 bytes (1 MB); image/jpeg (.jpg, .jpeg), image/png (.png), or image/webp (.webp); extension must match content typeOptional cover image upload replacing the stored cover URN
isRemoveImagebooleanNoDefault falseWhen true, clears the stored cover image reference (takes precedence over image)

Behavior & Side Effects

  • Optimistic concurrency: When If-Match contains a valid integer ETag, it is checked against the book’s current row version; mismatches return 412 Precondition Failed.
  • Transactional persistence: Atomically replaces book fields and author associations within a database transaction.
  • Cover image handling: Uploading image stores a new blob in catalog-blob and updates the book’s image URN; omitting both image and isRemoveImage=true preserves the existing cover; setting isRemoveImage=true clears 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 invalidates books:list and books:search cache 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 / CodeConditionClient Recovery Action
400 Bad RequestValidation failure (missing required fields, price <= 0, priceSale <= 0 or > price, length exceeded, invalid image size/type/extension) or malformed multipart payloadFix invalid form fields or file upload; do not retry unchanged input
401 UnauthorizedMissing, expired, or invalid Entra ID JWTAcquire a valid Entra ID access token and retry
403 ForbiddenToken lacks role business_user or admin, or lacks scopes catalog_read and catalog_writeRequest the required Entra ID app role and scopes
404 Not FoundNo active book exists with the supplied idVerify the book UUID; do not treat 404 as a completed update
412 Precondition FailedIf-Match version does not match the book’s current row versionFetch 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 RequestsRate limit quota exceeded (Retry-After header included)Wait for the Retry-After interval before retrying
500 Internal Server ErrorForeign-key violation, blob storage failure, or unhandled server error (traceId included)Verify referenced IDs exist and inspect service logs using traceId

Update book schema

10 properties

Multipart payload for updating a book listing.

Additional properties: not allowed
idstring<uuid>
required

Book UUID to update.

namestring
required
Min length: 1
descriptionstring
imagestring | null
pricenumber
required
Minimum: 0
priceSalenumber | null
Minimum: 0
categoryIdstring<uuid>
required

A UUID identifying the resource.

publisherIdstring<uuid>
required

A UUID identifying the resource.

authorIdsarray[string]
required
isRemoveImageboolean

Remove the existing cover when true.