openapi: 3.0.3 info: title: Product Discovery API version: 1.0.0 contact: name: product-discovery maintainers url: https://github.com/IQVO/product-discovery description: >- REST contract of the product-discovery bounded context of the digital storefront (storefront model, contexts[product-discovery].rest). Discovery is the read side of browsing and search (no aggregate in v1): ProductView per catalogue item (title, flags, content, category path, list and effective price, inStock, purchasable) and CategoryView (tree plus purchasable counts), fed by events from offer-availability, product-content and pricing. Search ranks title (A), category names (A), attributes (B) and description (C) in a PostgreSQL tsvector with a GIN index, with pg_trgm similarity as the typo fallback; facets are category, price band and in-stock; product-type queries also return category suggestions. Errors are RFC 9457 problem details (application/problem+json); this read-only surface uses not-found (404) and validation-failed (422), plus 400 problems for paging (invalid-limit, invalid-cursor, unknown-query-parameter). No authentication. A catalogue item the item master has not announced yet (a stub row) is invisible: GET /products/{id} answers 404 for it and search never lists it. The category path of a product is joined from the CategoryView at query time, so a category rename shows at once without re-indexing products. servers: - url: http://localhost:8080 tags: - name: Products description: Search and read ProductView projections. - name: Categories description: Browse the CategoryView tree. paths: /products: get: tags: [Products] operationId: searchProducts summary: Search and filter purchasable products description: >- SearchProducts over the ProductView projection. q runs full-text search (tsvector weights title A, category names A, attributes B, description C) with a pg_trgm similarity fallback for typos; filters combine with AND. Product-type queries also return category suggestions. Keyset pagination: limit (1-500, default 100) and the opaque cursor taken from the previous page's nextCursor; filters are repeated on every page. A query parameter the operation does not declare (for example the retired after) is a 400 unknown-query-parameter. parameters: - name: q in: query required: false description: Free-text query; whitespace is collapsed. More than 200 characters is 422. schema: type: string maxLength: 200 - name: categoryId in: query required: false description: Restrict to one category (surrounding whitespace is trimmed). schema: type: string - name: inStock in: query required: false description: Only `true` or `false` are accepted; anything else is 422. schema: type: boolean - name: priceMin in: query required: false schema: type: integer format: int64 minimum: 0 description: Effective price lower bound in minor units; negative, non-integer or above priceMax is 422. - name: priceMax in: query required: false schema: type: integer format: int64 minimum: 0 description: Effective price upper bound in minor units; negative or non-integer is 422. - name: sort in: query required: false description: Ordering; absent means relevance. Any other value is 422. schema: type: string enum: [relevance, price-asc, price-desc, title] - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Cursor' responses: '200': description: The matching products, with facets and category suggestions. content: application/json: schema: $ref: '#/components/schemas/ProductSearchResult' '400': $ref: '#/components/responses/BadRequest' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /products/{catalogItemId}: get: tags: [Products] operationId: getProduct summary: Get one product view description: >- GetProduct, the full ProductView of one catalogue item for the product page (SSR renders this in one call; delivery dates are loaded asynchronously afterwards by the BFF). parameters: - $ref: '#/components/parameters/CatalogItemId' - $ref: '#/components/parameters/IfNoneMatch' responses: '200': description: The product view. headers: ETag: $ref: '#/components/headers/ETag' Cache-Control: $ref: '#/components/headers/CacheControl' content: application/json: schema: $ref: '#/components/schemas/ProductView' '304': $ref: '#/components/responses/NotModified' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' /categories: get: tags: [Categories] operationId: listCategories x-pagination-exempt: view x-pagination-exempt-reason: >- One versioned CategoryView tree with purchasable counts rolled up the tree; the tree is a single composite resource and is meaningless in slices. summary: Get the category tree with purchasable counts description: >- ListCategories, the CategoryView: tree plus purchasable counts per category. parameters: - $ref: '#/components/parameters/IfNoneMatch' responses: '200': description: The category tree. headers: ETag: $ref: '#/components/headers/ETag' Cache-Control: $ref: '#/components/headers/CacheControl' content: application/json: schema: $ref: '#/components/schemas/CategoryViewList' '304': $ref: '#/components/responses/NotModified' '400': $ref: '#/components/responses/BadRequest' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/InternalError' components: parameters: Limit: name: limit in: query required: false schema: type: integer minimum: 1 maximum: 500 default: 100 Cursor: name: cursor in: query required: false description: Opaque keyset cursor; pass the nextCursor of the previous page unchanged, with the same filters and sort. schema: type: string CatalogItemId: name: catalogItemId in: path required: true schema: type: string IfNoneMatch: name: If-None-Match in: header required: false description: >- The ETag of a cached representation; when it still matches, the service answers 304 Not Modified with no body. `*` matches any current representation; a comma-separated list is accepted and a `W/` prefix on a candidate is ignored (weak comparison). schema: type: string headers: ETag: description: >- Strong validator of this representation (quoted hex of its SHA-256 prefix). It changes whenever the served read changes: a new content revision, a price version bump, a listing flip or a category rename. schema: type: string CacheControl: description: Freshness window every read may be cached for (CDN-friendly). schema: type: string responses: NotModified: description: The If-None-Match value still matches; no body is sent. headers: ETag: $ref: '#/components/headers/ETag' Cache-Control: $ref: '#/components/headers/CacheControl' BadRequest: description: >- invalid-limit, invalid-cursor, unknown-query-parameter (search only) or malformed-request (a NUL in the query string of any route). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' NotFound: description: >- not-found (no such product, a stub row, or an id longer than 128 characters) or resource-not-found (a NUL in the request path, on any route). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' Unprocessable: description: >- validation-failed (q longer than 200 characters, unknown sort, a non-boolean inStock, a non-integer, negative or inverted price bound). content: application/problem+json: schema: $ref: '#/components/schemas/Problem' InternalError: description: internal-error; the detail never carries the internal message. content: application/problem+json: schema: $ref: '#/components/schemas/Problem' schemas: Problem: type: object description: RFC 9457 problem details. required: [type, title, status, detail, instance] properties: type: type: string format: uri-reference description: Problem type, `/problems/`, for example /problems/validation-failed. title: type: string status: type: integer minimum: 400 maximum: 599 detail: type: string instance: type: string format: uri-reference description: The escaped request path. Money: type: object required: [amountMinor, currency] properties: amountMinor: type: integer format: int64 minimum: 0 currency: type: string pattern: '^[A-Z]{3}$' Attribute: type: object required: [name, value] properties: name: type: string value: type: string unit: type: string description: Omitted when the attribute has no unit. Media: type: object required: [mediaId, url, altText, role] properties: mediaId: type: string url: type: string format: uri altText: type: string role: type: string description: Passed through from the content event; PRIMARY marks the hit's primaryMedia. ProductView: type: object required: [catalogItemId, title, hazmat, fragile, inStock, purchasable] properties: catalogItemId: type: string title: type: string description: The item master's title (offer-availability owns it). hazmat: type: boolean fragile: type: boolean description: type: string description: Only present while the content is PUBLISHED (so are bullets, attributes, media, categoryId and categoryPath). bullets: type: array items: type: string attributes: type: array items: $ref: '#/components/schemas/Attribute' media: type: array items: $ref: '#/components/schemas/Media' categoryId: type: string description: The item's primary category, when its content names one. categoryPath: type: array description: Category names from the root to the item's primary category. items: type: string listPrice: $ref: '#/components/schemas/Money' effectivePrice: $ref: '#/components/schemas/Money' inStock: type: boolean description: At least one LIVE listing with availableQty > 0. purchasable: type: boolean description: Item ACTIVE, content PUBLISHED, price ACTIVE and in stock. An unpurchasable item is shown as currently unavailable; buying out-of-stock is impossible in this network. ProductHit: type: object required: [catalogItemId, title, inStock, purchasable] properties: catalogItemId: type: string title: type: string effectivePrice: $ref: '#/components/schemas/Money' primaryMedia: $ref: '#/components/schemas/Media' categoryId: type: string categoryPath: type: array items: type: string inStock: type: boolean purchasable: type: boolean Facet: type: object required: [name, values] properties: name: type: string description: category, price-band or in-stock, always in that order. enum: [category, price-band, in-stock] values: type: array items: type: object required: [value, count] properties: value: type: string count: type: integer minimum: 0 CategorySuggestion: type: object required: [categoryId, name] properties: categoryId: type: string name: type: string ProductSearchResult: type: object required: [items, facets] properties: items: type: array items: $ref: '#/components/schemas/ProductHit' facets: type: array items: $ref: '#/components/schemas/Facet' categorySuggestions: type: array description: Suggested categories for product-type queries. items: $ref: '#/components/schemas/CategorySuggestion' nextCursor: type: string description: Opaque keyset cursor; pass it as `cursor` for the next page. Absent on the last page. CategoryView: type: object required: [categoryId, parentId, name, path, purchasableCount] properties: categoryId: type: string parentId: type: string nullable: true description: null for a root category. name: type: string path: type: string purchasableCount: type: integer minimum: 0 CategoryViewList: type: object required: [version, categories] properties: version: type: integer minimum: 1 categories: type: array items: $ref: '#/components/schemas/CategoryView'