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

Read the architecture guide →

Update basket

Replaces a basket's item collection with the supplied items.

Order Lifecycle
PUT/api/v1/baskets

UpdateBasket replaces the entire item collection of the authenticated customer’s existing BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs in Basket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs (PUT /basket/api/v1/baskets) and returns 204 No Content. It requires an active basket to exist and rejects requests targeting a missing basket with 404 Not Found.

Overview

PropertyValue
Bounded ContextShopping
Owner ServiceBasket APIServicev1.0.0Basket APIInternal HTTP and gRPC service for managing customer-scoped shopping baskets, Catalog price enrichment, and post-checkou...PublishesGetBookGrpc, GetBooksGrpc +2SubscribesCreateBasket, UpdateBasket +4APIsOpenAPI, AsyncAPIOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs
Protocol / FormatHTTP PUT, application/json request, empty response (204 No Content)
Gateway EndpointPUT /basket/api/v1/baskets (service path /api/v1/baskets)
Authentication & AuthorizationMicrosoft Entra ID JWT — customer role plus scopes basket_read, basket_write
Idempotency / ConcurrencyNaturally idempotent full-list replacement (last write wins)
Rate Limit / CachingGlobal concurrency (100), per-IP fixed-window (30 req/min), and per-user token bucket (30 tokens, +20 per 10s, queue 5); stored in Redis with no TTL
Contract Version1.0.0 (ApiVersions.V1)

Request & Response Contract

Request Body (application/json)

NameTypeRequiredConstraintsDescription
itemsobject[]YesNon-empty arrayComplete replacement list of items for the customer’s basket
items[].idstringYesNon-empty stringIdentifier of the Catalog book
items[].quantityintegerYes>= 1Updated unit quantity for the book

Success Response (204 No Content)

Empty response body confirms the basket items were replaced.

Behavior & Side Effects

Note

OpenAPI metadata declares 404 Not Found as application/problem+json, whereas runtime responses return application/json with { "detail": "The requested resource was not found." }.

Error Responses

Status / CodeConditionClient Recovery Action
400 Bad RequestMissing items, empty items array, empty items[].id, items[].quantity <= 0, or malformed JSONFix the failing fields and resubmit
401 UnauthorizedMissing, expired, or invalid Entra ID bearer tokenAcquire a valid Entra ID access token and retry
403 ForbiddenValid token missing the customer role or basket_read/basket_write scopesRequest a token with the required role and scopes
404 Not FoundNo active basket exists in Redis for the authenticated customerCreate a basket via Create basketCommandv1.0.0Create basketCreates a basket containing the supplied item identifiers and quantities.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs before updating
429 Too Many RequestsRate limit quota exceeded (Retry-After header included)Wait for the Retry-After interval before retrying
500 Internal Server ErrorUnexpected Redis or server failure (traceId included)Retry with exponential backoff; inspect service logs using traceId

Update basket schema

3 properties
itemsarray[object]
required