62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
post:
|
|
operationId: PostCartsCartLineItems
|
|
summary: Add a Line Item
|
|
description: Generates a Line Item with a given Product Variant and adds it to the Cart
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
description: The id of the Cart to add the Line Item to.
|
|
schema:
|
|
type: string
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS Client
|
|
source:
|
|
$ref: ../code_samples/JavaScript/carts_{id}_line-items/postundefined
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/carts_{id}_line-items/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
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- variant_id
|
|
- quantity
|
|
properties:
|
|
variant_id:
|
|
type: string
|
|
description: The id of the Product Variant to generate the Line Item from.
|
|
quantity:
|
|
type: integer
|
|
description: The quantity of the Product Variant to add to the Line Item.
|
|
metadata:
|
|
type: object
|
|
description: >-
|
|
An optional key-value map with additional details about the Line
|
|
Item.
|