158 lines
4.2 KiB
YAML
158 lines
4.2 KiB
YAML
post:
|
|
operationId: PostDiscounts
|
|
summary: Creates a Discount
|
|
x-authenticated: true
|
|
description: >-
|
|
Creates a Discount with a given set of rules that define how the Discount
|
|
behaves.
|
|
parameters:
|
|
- in: query
|
|
name: expand
|
|
description: (Comma separated) Which fields should be expanded in the results.
|
|
schema:
|
|
type: string
|
|
- in: query
|
|
name: fields
|
|
description: (Comma separated) Which fields should be retrieved in the results.
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas/AdminPostDiscountsReq.yaml
|
|
x-codegen:
|
|
method: create
|
|
queryParams: AdminPostDiscountsParams
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS Client
|
|
source:
|
|
$ref: ../code_samples/JavaScript/discounts/post.js
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/discounts/post.sh
|
|
security:
|
|
- api_token: []
|
|
- cookie_auth: []
|
|
tags:
|
|
- Discount
|
|
responses:
|
|
'200':
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas/AdminDiscountsRes.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
|
|
get:
|
|
operationId: GetDiscounts
|
|
summary: List Discounts
|
|
x-authenticated: true
|
|
description: Retrieves a list of Discounts
|
|
parameters:
|
|
- in: query
|
|
name: q
|
|
description: Search query applied on the code field.
|
|
schema:
|
|
type: string
|
|
- in: query
|
|
name: rule
|
|
description: Discount Rules filters to apply on the search
|
|
schema:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum:
|
|
- fixed
|
|
- percentage
|
|
- free_shipping
|
|
description: >-
|
|
The type of the Discount, can be `fixed` for discounts that reduce
|
|
the price by a fixed amount, `percentage` for percentage
|
|
reductions or `free_shipping` for shipping vouchers.
|
|
allocation:
|
|
type: string
|
|
enum:
|
|
- total
|
|
- item
|
|
description: >-
|
|
The value that the discount represents; this will depend on the
|
|
type of the discount
|
|
- in: query
|
|
name: is_dynamic
|
|
description: Return only dynamic discounts.
|
|
schema:
|
|
type: boolean
|
|
- in: query
|
|
name: is_disabled
|
|
description: Return only disabled discounts.
|
|
schema:
|
|
type: boolean
|
|
- in: query
|
|
name: limit
|
|
description: The number of items in the response
|
|
schema:
|
|
type: number
|
|
default: '20'
|
|
- in: query
|
|
name: offset
|
|
description: The offset of items in response
|
|
schema:
|
|
type: number
|
|
default: '0'
|
|
- in: query
|
|
name: expand
|
|
description: Comma separated list of relations to include in the results.
|
|
schema:
|
|
type: string
|
|
x-codegen:
|
|
method: list
|
|
queryParams: AdminGetDiscountsParams
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS Client
|
|
source:
|
|
$ref: ../code_samples/JavaScript/discounts/get.js
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/discounts/get.sh
|
|
security:
|
|
- api_token: []
|
|
- cookie_auth: []
|
|
tags:
|
|
- Discount
|
|
responses:
|
|
'200':
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas/AdminDiscountsListRes.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
|