Files
medusa-store/docs/api/store/paths/carts_{id}.yaml
2022-09-13 10:59:51 +03:00

148 lines
4.5 KiB
YAML

get:
operationId: GetCartsCart
summary: Get a Cart
description: Retrieves a Cart.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: ../code_samples/JavaScript/carts_{id}/getundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/carts_{id}/getundefined
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.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
post:
operationId: PostCartsCart
summary: Update a Cart
description: Updates a Cart.
parameters:
- in: path
name: id
required: true
description: The id of the Cart.
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
region_id:
type: string
description: The id of the Region to create the Cart in.
country_code:
type: string
description: The 2 character ISO country code to create the Cart in.
externalDocs:
url: >-
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
description: See a list of codes.
email:
type: string
description: An email to be used on the Cart.
format: email
sales_channel_id:
type: string
description: The ID of the Sales channel to update the Cart with.
billing_address:
description: The Address to be used for billing purposes.
anyOf:
- $ref: ../components/schemas/address.yaml
description: A full billing address object.
- type: string
description: The billing address ID
shipping_address:
description: The Address to be used for shipping.
anyOf:
- $ref: ../components/schemas/address.yaml
description: A full shipping address object.
- type: string
description: The shipping address ID
gift_cards:
description: An array of Gift Card codes to add to the Cart.
type: array
items:
required:
- code
properties:
code:
description: The code that a Gift Card is identified by.
type: string
discounts:
description: An array of Discount codes to add to the Cart.
type: array
items:
required:
- code
properties:
code:
description: The code that a Discount is identifed by.
type: string
customer_id:
description: The ID of the Customer to associate the Cart with.
type: string
context:
description: An optional object to provide context to the Cart.
type: object
example:
ip: '::1'
user_agent: Chrome
x-codeSamples:
- lang: JavaScript
label: JS Client
source:
$ref: ../code_samples/JavaScript/carts_{id}/postundefined
- lang: Shell
label: cURL
source:
$ref: ../code_samples/Shell/carts_{id}/postundefined
tags:
- Cart
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
cart:
$ref: ../components/schemas/cart.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