70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
post:
|
|
operationId: PostDiscountsDiscountDynamicCodes
|
|
summary: Create a Dynamic Code
|
|
description: >-
|
|
Creates a dynamic unique code that can map to a parent Discount. This is
|
|
useful if you want to automatically generate codes with the same behaviour.
|
|
x-authenticated: true
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
description: The ID of the Discount to create the dynamic code from."
|
|
schema:
|
|
type: string
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS Client
|
|
source:
|
|
$ref: ../code_samples/JavaScript/discounts_{id}_dynamic-codes/postundefined
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/discounts_{id}_dynamic-codes/postundefined
|
|
security:
|
|
- api_token: []
|
|
- cookie_auth: []
|
|
tags:
|
|
- Discount
|
|
responses:
|
|
'200':
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
properties:
|
|
discount:
|
|
$ref: ../components/schemas/discount.yaml
|
|
'400':
|
|
$ref: ../components/responses/400_error.yaml
|
|
'401':
|
|
$ref: ../components/responses/unauthorized.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:
|
|
- code
|
|
properties:
|
|
code:
|
|
type: string
|
|
description: The unique code that will be used to redeem the Discount.
|
|
usage_limit:
|
|
type: number
|
|
default: '1'
|
|
description: amount of times the discount can be applied.
|
|
metadata:
|
|
type: object
|
|
description: >-
|
|
An optional set of key-value paris to hold additional
|
|
information.
|