Create book
Creates a book listing and returns its generated UUID.
/api/v1/booksCreateBook creates a new book listing 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 (POST /catalog/api/v1/books) from a multipart/form-data payload, optionally associates a cover image, and returns 201 Created with the generated UUIDv7 and a Location header.
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 POST, multipart/form-data request, JSON string response |
| Gateway Endpoint | POST /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 | Not idempotent; no x-request-id header is required or enforced |
| Rate Limit / Caching | Global concurrency (100) and fixed-window (30 req/min) limiters plus per-user token bucket; invalidates book list and search caches |
| Contract Version | 1.0.0 (ApiVersions.V1) |
Request & Response Contract
Request Form Fields (multipart/form-data)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
name | string | Yes | Non-empty, max 50 characters | Book title |
description | string | No | Default "", max 500 characters | Book summary text |
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 |
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 | Author identifiers associated with the book |
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 |
Success Response (201 Created)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
Location header | string | Yes | Relative path /api/v1/books/{id} | URI of the created book resource |
| Root body | string | Yes | UUIDv7 | Generated unique identifier of the created book |
Behavior & Side Effects
- Transactional persistence: Saves the BookEntityv1.0.0BookCanonical sellable title in the product catalog, encapsulating descriptive metadata, pricing, stock availability, taxono...Ownercatalog-experience-teamOpen docs with initial status
InStock,averageRating = 0.0,totalReviews = 0, andisDeleted = false. - Cache invalidation: Invalidates cached book lists (
books:list) and search results (books:search). - Vector index queueing: Database triggers enqueue the new book ID for asynchronous vector 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 (every 5 minutes via Process Vector Batch ChannelChannelv1.0.0Process Vector Batch ChannelUnprefixed Kafka trigger topic owned by the platform team used by Scheduler Service every five minutes to initiate Catal...Ownerai-capabilities-teamOpen docs).
Known runtime behavior: Due to a response-type mismatch in the mediator pre-processing pipeline for this command, the cover image upload step does not execute automatically during book creation. Upload or update cover images via Update bookCommandv1.0.0Update bookUpdates an existing book listing, including optional image and catalog relationships.Ownercatalog-experience-teamSchemaDiagramOpen docs until the pipeline registration is aligned.
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 |
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 (non-existent categoryId, publisherId, or authorIds), blob upload 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.
- Update bookCommandv1.0.0Update bookUpdates an existing book listing, including optional image and catalog relationships.Ownercatalog-experience-teamSchemaDiagramOpen docs — Replace an existing book listing and manage cover images.
- Delete bookCommandv1.0.0Delete bookDeletes an existing book from the Catalog.Ownercatalog-experience-teamSchemaDiagramOpen docs — Soft-delete an existing book listing.
- Create authorCommandv1.0.0Create authorCreates an author in the Catalog.Ownercatalog-experience-teamSchemaDiagramOpen docs — Create author records before linking them to books.
- Create categoryCommandv1.0.0Create categoryCreates a category in the Catalog.Ownercatalog-experience-teamSchemaDiagramOpen docs — Create category records before linking them to books.
- Create publisherCommandv1.0.0Create publisherCreates a publisher in the Catalog.Ownercatalog-experience-teamSchemaDiagramOpen docs — Create publisher records before linking them to books.
Create book schema
Multipart payload for creating a book listing.
not allowedBook title.
1Book description.
1Optional cover image file.
Regular price.
0Optional sale price.
0Category UUID.
Publisher UUID.
Authors associated with the book.