openapi: 3.0.3 info: title: Product Content API version: 0.1.0 contact: name: product-content maintainers url: https://github.com/IQVO/product-content description: >- REST contract of the product-content bounded context of the digital storefront (model: warehouse-docs storefront/model/model.yaml, contexts[product-content], with the FINAL model-gap decisions applied). Product Content enriches the network's catalogue item with description, bullets (<= 10), attributes (<= 50), media (<= 12, URLs to static assets only; upload is out of scope) and the category tree. The title stays the item master's. Content publishes only when complete: a description, exactly one PRIMARY medium and a category. Content lifecycle: DRAFT (revisable, discardable) -> PUBLISHED (revisable, publishable again with the new revision) -> RETIRED (terminal). The category tree is ONE live aggregate without a draft state: every category write applies to the live tree and publishes a new version (CategoryTreePublished). Categories are never deleted. Errors are RFC 9457 problem details (application/problem+json) whose type is /problems/; shared types are not-found (404), illegal-transition (409), concurrent-update (409) and validation-failed (422), plus one kebab-case slug per Err of the model. Every POST takes an Idempotency-Key header (24 hours); PUT and DELETE are idempotent by method. A 2xx and a FINAL refusal are stored under the key and replayed to a retry; a RETRYABLE refusal (nothing committed, the answer depends on state that can change) is not stored: the key is released, a retry executes again, and another request under the released key is new. Routes follow the fleet REST API guideline: nouns, never verbs (a lifecycle transition is a transition resource such as /revisions or /publications). No authentication. servers: - url: http://localhost:8080 tags: - name: ProductContents description: Content per catalogue item (ProductContent, revisions). - name: Categories description: The single, versioned category tree (CategoryTree). paths: /product-contents: post: tags: [ProductContents] operationId: createProductContent summary: Create the draft content of a catalogue item description: >- CreateProductContent. The item must exist in the local CatalogItemView (fed by offer-availability events) and must not be discontinued. The content starts DRAFT at revision 1; the body may be incomplete (the publish gate is checked by POST /product-contents/{catalogItemId}/publications). A second create for the same item is a 409 concurrent-update. parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ProductContentInput' responses: '201': description: The created content (DRAFT). headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/ProductContent' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '422': description: >- validation-failed, unknown-catalog-item (ErrUnknownCatalogItem), item-discontinued (ErrItemDiscontinued), unknown-category (ErrUnknownCategory), too-many-bullets (ErrTooManyBullets), too-many-attributes (ErrTooManyAttributes) or too-many-media (ErrTooManyMedia). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' get: tags: [ProductContents] operationId: listProductContents summary: List product contents, paged (projection bootstrap) description: >- Keyset-paged list of product contents of every state, ordered by catalogItemId. Used by product-discovery's projection rebuild (snapshot + catch-up); not part of a user request path. Follow nextCursor until it is absent. Any query parameter other than limit and cursor is a 400 unknown-query-parameter. parameters: - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: One page of product contents. content: application/json: schema: $ref: '#/components/schemas/ProductContentPage' '400': $ref: '#/components/responses/BadRequestPage' '500': $ref: '#/components/responses/InternalError' /product-contents/{catalogItemId}: get: tags: [ProductContents] operationId: getProductContent summary: Get the content of one catalogue item description: Returns the ProductContent with its current revision. parameters: - $ref: '#/components/parameters/CatalogItemId' responses: '200': description: The product content. content: application/json: schema: $ref: '#/components/schemas/ProductContent' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /product-contents/{catalogItemId}/revisions: post: tags: [ProductContents] operationId: reviseProductContent summary: Revise the content of a catalogue item description: >- ReviseDraft (DRAFT to DRAFT) or ReviseContent (PUBLISHED to PUBLISHED), chosen by the state. The body replaces the whole editable content and takes a new revision. PUBLISHED content must stay complete (incomplete-content otherwise) and shoppers see the revision only after POST /product-contents/{catalogItemId}/publications publishes it. Revising RETIRED content is a 409 content-retired. parameters: - $ref: '#/components/parameters/CatalogItemId' - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ReviseInput' responses: '200': description: The revised content. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/ProductContent' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': description: content-retired (ErrContentRetired), concurrent-update or idempotency-key-reused. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '422': description: >- validation-failed, unknown-category (ErrUnknownCategory), incomplete-content (ErrIncompleteContent, PUBLISHED content only), too-many-bullets, too-many-attributes or too-many-media. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' /product-contents/{catalogItemId}/publications: post: tags: [ProductContents] operationId: publishProductContent summary: Publish the content of a catalogue item description: >- PublishContent. DRAFT to PUBLISHED, or PUBLISHED to PUBLISHED when a revision is waiting. Publish needs a description, exactly one PRIMARY medium and a category (ErrIncompleteContent) and a catalogue item that is not discontinued. Publishes ProductContentPublished with the current revision. PUBLISHED content whose current revision is already published is returned unchanged and publishes nothing. parameters: - $ref: '#/components/parameters/CatalogItemId' - $ref: '#/components/parameters/IdempotencyKey' responses: '200': description: The published content. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/ProductContent' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': description: content-retired (ErrContentRetired), concurrent-update or idempotency-key-reused. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '422': description: >- incomplete-content (ErrIncompleteContent), unknown-category (ErrUnknownCategory), unknown-catalog-item (ErrUnknownCatalogItem) or item-discontinued (ErrItemDiscontinued). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' /product-contents/{catalogItemId}/retirements: post: tags: [ProductContents] operationId: retireProductContent summary: Retire the published content of a catalogue item description: >- RetireContent. PUBLISHED to RETIRED (terminal). A DRAFT is discarded with DELETE /product-contents/{catalogItemId}/draft instead. RetireOnDiscontinue retires content automatically when the network discontinues the item. Publishes ProductContentRetired. parameters: - $ref: '#/components/parameters/CatalogItemId' - $ref: '#/components/parameters/IdempotencyKey' responses: '200': description: The retired content. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/ProductContent' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '409': description: illegal-transition (the content is DRAFT or already RETIRED), concurrent-update or idempotency-key-reused. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' /product-contents/{catalogItemId}/draft: delete: tags: [ProductContents] operationId: discardProductContentDraft summary: Discard the draft content of a catalogue item description: >- DiscardDraft. DRAFT to RETIRED with retiredReason DISCARDED. Nothing was ever published, so no event is raised. DELETE is idempotent by method and takes no Idempotency-Key; a repeat finds the content already RETIRED and answers 409 illegal-transition. parameters: - $ref: '#/components/parameters/CatalogItemId' responses: '200': description: The discarded content (RETIRED, reason DISCARDED). content: application/json: schema: $ref: '#/components/schemas/ProductContent' '404': $ref: '#/components/responses/NotFound' '409': description: illegal-transition (the content is not a DRAFT) or concurrent-update. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' /categories: post: tags: [Categories] operationId: createCategory summary: Create a category in the live tree description: >- CreateCategory. Applies to the live tree and publishes a new tree version (CategoryTreePublished). The tree is at most four levels deep and never contains a cycle; siblings never share a name (compared case-insensitively). The category id is minted by the service. parameters: - $ref: '#/components/parameters/IdempotencyKey' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CategoryInput' responses: '201': description: The created category. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/Category' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '422': description: >- validation-failed, unknown-category (the parent is not in the tree), max-depth (ErrMaxDepth) or duplicate-sibling-name (ErrDuplicateSiblingName). Also validation-failed when the tree already holds its 5000 categories. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' get: tags: [Categories] operationId: listCategories summary: Get the category tree x-pagination-exempt: view description: >- Returns the categories of the current CategoryTree version, ordered by path (parents before children). Before the first category the tree is version 0 and empty. Not paged (x-pagination-exempt: view): the tree is ONE versioned aggregate, so one response is one consistent snapshot of one version; the tree is at most four levels deep. responses: '200': description: The category tree. content: application/json: schema: $ref: '#/components/schemas/CategoryList' '500': $ref: '#/components/responses/InternalError' /category-tree-publications: post: tags: [Categories] operationId: publishCategoryTree summary: Publish the category tree again description: >- PublishCategoryTree. Publishes the live tree under a new version (PUBLISHED to PUBLISHED), for example to re-send it to a consumer. Every category write already publishes; this call changes no category. parameters: - $ref: '#/components/parameters/IdempotencyKey' responses: '200': description: The published tree. headers: Idempotency-Replayed: $ref: '#/components/headers/IdempotencyReplayed' content: application/json: schema: $ref: '#/components/schemas/CategoryList' '400': $ref: '#/components/responses/BadRequest' '409': $ref: '#/components/responses/Conflict' '500': $ref: '#/components/responses/InternalError' /categories/{categoryId}/parent: put: tags: [Categories] operationId: moveCategory summary: Move a category under a new parent description: >- MoveCategory. Replaces the parent of the category; the subtree moves with it. Moving never creates a cycle and never exceeds depth four. Publishes a new tree version. PUT is idempotent by method and takes no Idempotency-Key. parameters: - $ref: '#/components/parameters/CategoryId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MoveCategoryRequest' responses: '200': description: The moved category. content: application/json: schema: $ref: '#/components/schemas/Category' '400': $ref: '#/components/responses/BadRequestBody' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': description: >- validation-failed, unknown-category (the new parent is not in the tree), category-cycle (ErrCategoryCycle), max-depth (ErrMaxDepth) or duplicate-sibling-name (ErrDuplicateSiblingName). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' /categories/{categoryId}/name: put: tags: [Categories] operationId: renameCategory summary: Rename a category description: >- RenameCategory. Replaces the name of the category. Siblings never share a name. The paths of the subtree follow. Publishes a new tree version. PUT is idempotent by method and takes no Idempotency-Key. parameters: - $ref: '#/components/parameters/CategoryId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RenameCategoryRequest' responses: '200': description: The renamed category. content: application/json: schema: $ref: '#/components/schemas/Category' '400': $ref: '#/components/responses/BadRequestBody' '404': $ref: '#/components/responses/NotFound' '409': $ref: '#/components/responses/Conflict' '422': description: validation-failed or duplicate-sibling-name (ErrDuplicateSiblingName). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' '500': $ref: '#/components/responses/InternalError' components: parameters: IdempotencyKey: name: Idempotency-Key in: header required: true description: >- Client-generated UUID per logical submit (1 to 128 printable ASCII characters); a retry reuses it. The same key with the same request (method, path, body) replays the stored answer with Idempotency-Replayed: true; the same key with another request is 409 idempotency-key-reused. Stored answers are a 2xx and a FINAL refusal (malformed-request, too-many-*); a RETRYABLE refusal (unknown-catalog-item, unknown-category, not-found, incomplete-content, concurrent-update, illegal-transition, ...) is not stored and releases the key, so the same key executes the work again. Missing is 400 idempotency-key-required, malformed is 400 idempotency-key-invalid. schema: type: string minLength: 1 maxLength: 128 Limit: name: limit in: query required: false description: Page size, 1 to 500 (default 100). Anything else is 400 invalid-limit. schema: type: integer minimum: 1 maximum: 500 default: 100 Cursor: name: cursor in: query required: false description: Opaque token copied from the previous page's nextCursor; absent on the first page. One that does not decode is 400 invalid-cursor. schema: type: string CatalogItemId: name: catalogItemId in: path required: true description: Catalogue item id. An empty id or one longer than 128 characters can never name a resource and is a 404 not-found. schema: type: string minLength: 1 maxLength: 128 CategoryId: name: categoryId in: path required: true description: Category id. An empty id or one longer than 128 characters can never name a resource and is a 404 not-found. schema: type: string minLength: 1 maxLength: 128 headers: IdempotencyReplayed: description: '"true" when the answer is the stored response of an earlier request with the same Idempotency-Key; absent on the first execution.' schema: type: string enum: ['true'] responses: BadRequest: description: >- idempotency-key-required (no Idempotency-Key header), idempotency-key-invalid (not 1 to 128 printable ASCII characters) or malformed-request (the body is empty, not valid JSON, has an unknown field, a field of the wrong type, trailing data, is larger than 64 KiB or contains a NUL character, U+0000, also as the escape \u0000; a NUL in the query string is the same 400). The Idempotency-Key checks run first and a request rejected here never records its key. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' BadRequestPage: description: >- invalid-limit (limit is not an integer from 1 to 500; also an empty or repeated limit), invalid-cursor (cursor does not decode, is repeated, or was not issued by this list), unknown-query-parameter (any parameter other than limit and cursor) or malformed-request (a NUL character in the query string). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' BadRequestBody: description: >- malformed-request: the body is empty, not valid JSON, has an unknown field, a field of the wrong type, trailing data, is larger than 64 KiB or contains a NUL character (U+0000, also as the escape \u0000). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' NotFound: description: >- not-found (the resource does not exist, or the path id is empty or longer than 128 characters). A NUL character in the path is a 404 resource-not-found. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' Conflict: description: >- concurrent-update (another writer got in between the load and the save; RETRYABLE: not stored, the key is released and a retry executes again), a business conflict, or idempotency-key-reused (the Idempotency-Key was already used with a different method, path or body). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' InternalError: description: internal-error. The detail never leaks the cause ("an unexpected error occurred"); a 5xx is never stored under an Idempotency-Key. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' schemas: Problem: type: object description: RFC 9457 problem details. required: [type, title, status] properties: type: type: string format: uri-reference description: Problem type, /problems/, for example /problems/incomplete-content. title: type: string status: type: integer minimum: 400 maximum: 599 detail: type: string instance: type: string format: uri-reference Attribute: type: object description: Texts are trimmed (no leading or trailing whitespace) and free of control characters; a violation is 422 validation-failed. required: [name, value] properties: name: type: string minLength: 1 maxLength: 100 value: type: string minLength: 1 maxLength: 300 unit: type: string minLength: 1 maxLength: 20 nullable: true description: Optional; null or absent means no unit. A response omits it when there is none. Media: type: object required: [mediaId, url, altText, role] properties: mediaId: allOf: - $ref: '#/components/schemas/Id' description: Unique within the content. url: type: string format: uri maxLength: 2048 description: Absolute http(s) URL (host required, no surrounding whitespace) to a static asset; media upload is out of scope. altText: type: string minLength: 1 maxLength: 200 role: type: string enum: [PRIMARY, GALLERY] Id: type: string description: 'Opaque id, 1 to 64 characters from A-Z a-z 0-9 . _ : - starting with a letter or a digit.' minLength: 1 maxLength: 64 pattern: '^[A-Za-z0-9][A-Za-z0-9._:-]*$' ContentBody: type: object description: >- The editable content, replaced as a whole by create and revise (an absent field means empty). Texts are trimmed and free of control characters. Bounds: 10 bullets, 50 attributes, 12 media; a violation is 422 too-many-bullets, too-many-attributes or too-many-media. properties: description: type: string maxLength: 4000 description: Trimmed text; empty or absent on a draft, required to publish. bullets: type: array maxItems: 10 items: type: string minLength: 1 maxLength: 300 attributes: type: array maxItems: 50 items: $ref: '#/components/schemas/Attribute' media: type: array maxItems: 12 items: $ref: '#/components/schemas/Media' primaryCategoryId: allOf: - $ref: '#/components/schemas/Id' description: A category of the live tree (422 unknown-category otherwise); required to publish. ProductContentInput: allOf: - type: object required: [catalogItemId] properties: catalogItemId: $ref: '#/components/schemas/Id' - $ref: '#/components/schemas/ContentBody' ReviseInput: allOf: - type: object properties: catalogItemId: type: string description: Optional; when present it must equal the path parameter (422 validation-failed otherwise). - $ref: '#/components/schemas/ContentBody' ProductContent: allOf: - type: object required: [catalogItemId, state, description, bullets, attributes, media, revision, publishedRevision, createdAt, updatedAt] properties: catalogItemId: type: string state: type: string enum: [DRAFT, PUBLISHED, RETIRED] revision: type: integer minimum: 1 description: The revision of the current shape; every revise takes a new one. publishedRevision: type: integer minimum: 0 description: The revision last published (0 = never). Shoppers see this revision; a PUBLISHED content with revision above it waits for a publication. retiredReason: type: string enum: [MANUAL, DISCARDED, DISCONTINUED] description: Present exactly when the state is RETIRED. createdAt: type: string format: date-time updatedAt: type: string format: date-time publishedAt: type: string format: date-time description: Present once a revision was published. retiredAt: type: string format: date-time description: Present exactly when the state is RETIRED. - $ref: '#/components/schemas/ContentBody' description: The response always carries description (empty when unset), bullets, attributes and media (empty arrays); primaryCategoryId is omitted when unset. ProductContentPage: type: object required: [items] properties: items: type: array items: $ref: '#/components/schemas/ProductContent' nextCursor: type: string description: Opaque cursor of the next page; absent on the last page. Category: type: object required: [categoryId, name, path] properties: categoryId: type: string parentId: type: string description: The parent category id; omitted for a root category. name: type: string path: type: string description: The names from the root joined with "/". CategoryInput: type: object required: [name] properties: parentId: type: string nullable: true description: The parent; null or absent creates a root category. name: type: string minLength: 1 maxLength: 100 description: 'Trimmed text without a slash or control characters (422 validation-failed otherwise).' MoveCategoryRequest: type: object properties: parentId: type: string nullable: true description: The new parent; null or absent moves the category to the root. RenameCategoryRequest: type: object required: [name] properties: name: type: string minLength: 1 maxLength: 100 description: 'Trimmed text without a slash or control characters (422 validation-failed otherwise).' CategoryList: type: object required: [version, categories] properties: version: type: integer format: int64 minimum: 0 categories: type: array items: $ref: '#/components/schemas/Category'