Get basket over gRPC
Returns the current basket through the basket.v1 gRPC contract.
GetBasketGrpc invokes the internal basket.v1.BasketGrpcService/GetBasket gRPC unary RPC on 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 to retrieve the authenticated customer’s basket items and quantities. Order APIServicev1.0.0Order APIAuthenticated Ordering service for Buyer profiles and the Order lifecycle,
creating Orders from baskets, snapshotting pr...PublishesGetBasketGrpc, GetBookGrpc +5SubscribesCreateOrder, CompleteOrder +11APIsOpenAPI, AsyncAPI, Carrier Service LevelsOwnercommerce-fulfillment-teamDiagramRepositoryOpen docs calls this RPC synchronously during order creation using an On-Behalf-Of (OBO) Microsoft Entra ID access token exchanged for Basket API.
Overview
| Property | Value |
|---|---|
| Bounded Context | Shopping |
| Owner Service | 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 |
| Protocol / Format | gRPC unary RPC (basket.v1.BasketGrpcService/GetBasket), Protobuf edition = "2023" |
| Gateway Endpoint | Internal gRPC RPC basket.v1.BasketGrpcService/GetBasket (not exposed via API Gateway) |
| Authentication & Authorization | Microsoft Entra ID JWT via Authorization: Bearer <token> metadata (customer OBO token with basket_read/basket_write scopes) |
| Idempotency / Concurrency | Read-only and naturally idempotent |
| Rate Limit / Caching | Per-user token bucket (30 limit, 20 per 10s, queue 5); backed by Redis |
| Contract Version | 1.0.0 |
Request & Response Contract
Request Message (google.protobuf.Empty)
Empty google.protobuf.Empty message; customer identity is derived from the authenticated gRPC call context.
Success Response (GetBasketResponse)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
id | string | Yes | Tag 1 (empty string if no basket exists) | Basket identifier |
items | Item[] | Yes | Tag 2 (repeated; empty list if no basket exists) | Items currently stored in the basket |
items[].id | string | Yes | Tag 1 | Catalog book identifier |
items[].quantity | int32 | Yes | Tag 2 | Quantity of the book in the basket |
When no basket exists in Redis for the authenticated customer, this RPC returns an empty GetBasketResponse (id = "", items = []) rather than NotFound (5). Callers must check items length before proceeding.
Behavior & Side Effects
- Redis lookup: Reads
basket:{userId}directly from Redis without Catalog enrichment. - No state mutation: Pure read RPC with no database writes or integration events.
Error Responses
| Status / Code | Condition | Client Recovery Action |
|---|---|---|
Unauthenticated (16) | Missing/invalid Entra ID token or empty user identity | Exchange a valid customer OBO token for Basket API and retry |
PermissionDenied (7) | Authenticated principal fails Basket API authorization policy | Verify customer role and basket_read/basket_write scopes |
ResourceExhausted (8) | Caller exceeded per-user rate limit | Retry with exponential backoff |
Unavailable (14) | Basket API or backing Redis instance is unreachable | Retry within budgeted resilience policy; fail checkout if unavailable |
Related Documentation
- 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 — Service overview, Redis persistence, and endpoints.
- BasketEntityv1.0.0BasketCustomer-scoped, mutable pre-order collection of requested books and quantities managed prior to checkout.Ownercommerce-fulfillment-teamOpen docs — Basket entity model.
- Get basketQueryv1.0.0Get basketReturns the current basket and its item details.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Public HTTP endpoint that enriches basket items with Catalog details.
- Create orderCommandv1.0.0Create orderCreates an Order for the authenticated Buyer using the current basket and Catalog pricing.Ownercommerce-fulfillment-teamSchemaDiagramOpen docs — Ordering API checkout flow that calls
GetBasket.