Files
medusa-store/docs/api/store/paths/store_variants.yaml
github-actions[bot] 658339767b chore(docs): Generated API Reference (#4706)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
2023-08-07 16:54:48 +03:00

173 lines
5.2 KiB
YAML

get:
operationId: GetVariants
summary: Get Product Variants
description: >
Retrieves a list of product variants. The product variants can be filtered
by fields such as `id` or `title`. The product variants can also be
paginated.
For accurate and correct pricing of the product variants based on the
customer's context, it's highly recommended to pass fields such as
`region_id`, `currency_code`, and `cart_id` when available.
Passing `sales_channel_id` ensures retrieving only variants of products
available in the specified sales channel.
You can alternatively use a publishable API key in the request header
instead of passing a `sales_channel_id`.
externalDocs:
description: How to pass product pricing parameters
url: >-
https://docs.medusajs.com/modules/products/storefront/show-products#product-pricing-parameters
parameters:
- in: query
name: ids
description: >-
Filter by a comma-separated list of IDs. If supplied, it overrides the
`id` parameter.
schema:
type: string
- in: query
name: id
style: form
explode: false
description: >-
Filter by one or more IDs. If `ids` is supplied, it's overrides the
value of this parameter.
schema:
oneOf:
- type: string
description: Filter by an ID.
- type: array
description: Filter by IDs.
items:
type: string
- in: query
name: sales_channel_id
description: >-
"Filter by sales channel IDs. When provided, only products available in
the selected sales channels are retrieved. Alternatively, you can pass a
publishable API key in the request header and this will have the same
effect."
schema:
type: string
- in: query
name: expand
description: >-
Comma-separated relations that should be expanded in the returned
product variants.
schema:
type: string
- in: query
name: fields
description: >-
Comma-separated fields that should be included in the returned product
variants.
schema:
type: string
- in: query
name: offset
description: The number of products to skip when retrieving the product variants.
schema:
type: number
default: '0'
- in: query
name: limit
description: Limit the number of product variants returned.
schema:
type: number
default: '100'
- in: query
name: cart_id
description: >-
The ID of the cart. This is useful for accurate pricing based on the
cart's context.
schema:
type: string
- in: query
name: region_id
description: >-
The ID of the region. This is useful for accurate pricing based on the
selected region.
schema:
type: string
- in: query
name: currency_code
style: form
explode: false
description: >-
A 3 character ISO currency code. This is useful for accurate pricing
based on the selected currency.
schema:
type: string
externalDocs:
url: https://en.wikipedia.org/wiki/ISO_4217#Active_codes
description: See a list of codes.
- in: query
name: title
style: form
explode: false
description: Filter by title
schema:
oneOf:
- type: string
description: a single title to filter by
- type: array
description: multiple titles to filter by
items:
type: string
- in: query
name: inventory_quantity
description: Filter by available inventory quantity
schema:
oneOf:
- type: number
description: A specific number to filter by.
- type: object
description: Filter using less and greater than comparisons.
properties:
lt:
type: number
description: Filter by inventory quantity less than this number
gt:
type: number
description: Filter by inventory quantity greater than this number
lte:
type: number
description: Filter by inventory quantity less than or equal to this number
gte:
type: number
description: >-
Filter by inventory quantity greater than or equal to this
number
x-codegen:
method: list
queryParams: StoreGetVariantsParams
x-codeSamples:
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/store_variants/get.sh
tags:
- Product Variants
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ../components/schemas/StoreVariantsListRes.yaml
'400':
$ref: ../components/responses/400_error.yaml
'404':
$ref: ../components/responses/not_found_error.yaml
'409':
$ref: ../components/responses/invalid_state_error.yaml
'422':
$ref: ../components/responses/invalid_request_error.yaml
'500':
$ref: ../components/responses/500_error.yaml