275 lines
9.3 KiB
YAML
275 lines
9.3 KiB
YAML
get:
|
|
operationId: GetCampaigns
|
|
summary: List Campaigns
|
|
description: >-
|
|
Retrieve a list of campaigns. The campaigns can be filtered by fields such
|
|
as `id`. The campaigns can also be sorted or paginated.
|
|
x-authenticated: true
|
|
parameters:
|
|
- name: fields
|
|
in: query
|
|
description: >-
|
|
Comma-separated fields that should be included in the returned data. if
|
|
a field is prefixed with `+` it will be added to the default fields,
|
|
using `-` will remove it from the default fields. without prefix it will
|
|
replace the entire default fields.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
title: fields
|
|
description: >-
|
|
Comma-separated fields that should be included in the returned data.
|
|
if a field is prefixed with `+` it will be added to the default
|
|
fields, using `-` will remove it from the default fields. without
|
|
prefix it will replace the entire default fields.
|
|
externalDocs:
|
|
url: '#select-fields-and-relations'
|
|
- name: offset
|
|
in: query
|
|
description: The number of items to skip when retrieving a list.
|
|
required: false
|
|
schema:
|
|
type: number
|
|
title: offset
|
|
description: The number of items to skip when retrieving a list.
|
|
externalDocs:
|
|
url: '#pagination'
|
|
- name: limit
|
|
in: query
|
|
description: Limit the number of items returned in the list.
|
|
required: false
|
|
schema:
|
|
type: number
|
|
title: limit
|
|
description: Limit the number of items returned in the list.
|
|
externalDocs:
|
|
url: '#pagination'
|
|
- name: order
|
|
in: query
|
|
description: >-
|
|
The field to sort the data by. By default, the sort order is ascending.
|
|
To change the order to descending, prefix the field name with `-`.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
title: order
|
|
description: >-
|
|
The field to sort the data by. By default, the sort order is
|
|
ascending. To change the order to descending, prefix the field name
|
|
with `-`.
|
|
security:
|
|
- api_token: []
|
|
- cookie_auth: []
|
|
- jwt_token: []
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS SDK
|
|
source:
|
|
$ref: ../code_samples/JavaScript/admin_campaigns/get.js
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/admin_campaigns/get.sh
|
|
tags:
|
|
- Campaigns
|
|
responses:
|
|
'200':
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- type: object
|
|
description: The paginated list of campaigns.
|
|
required:
|
|
- limit
|
|
- offset
|
|
- count
|
|
properties:
|
|
limit:
|
|
type: number
|
|
title: limit
|
|
description: The maximum number of items retrieved.
|
|
offset:
|
|
type: number
|
|
title: offset
|
|
description: The number of its skipped before the returned items.
|
|
count:
|
|
type: number
|
|
title: count
|
|
description: The total number of items.
|
|
- type: object
|
|
description: The list of campaigns
|
|
required:
|
|
- campaigns
|
|
properties:
|
|
campaigns:
|
|
type: array
|
|
description: The list of campaigns.
|
|
items:
|
|
$ref: ../components/schemas/CampaignResponse.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
|
|
post:
|
|
operationId: PostCampaigns
|
|
summary: Create Campaign
|
|
description: Create a campaign.
|
|
x-authenticated: true
|
|
parameters:
|
|
- name: fields
|
|
in: query
|
|
description: >-
|
|
Comma-separated fields that should be included in the returned data. if
|
|
a field is prefixed with `+` it will be added to the default fields,
|
|
using `-` will remove it from the default fields. without prefix it will
|
|
replace the entire default fields.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
title: fields
|
|
description: >-
|
|
Comma-separated fields that should be included in the returned data.
|
|
if a field is prefixed with `+` it will be added to the default
|
|
fields, using `-` will remove it from the default fields. without
|
|
prefix it will replace the entire default fields.
|
|
externalDocs:
|
|
url: '#select-fields-and-relations'
|
|
security:
|
|
- api_token: []
|
|
- cookie_auth: []
|
|
- jwt_token: []
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- type: object
|
|
description: The campaign's details.
|
|
required:
|
|
- name
|
|
- campaign_identifier
|
|
- description
|
|
- budget
|
|
- starts_at
|
|
- ends_at
|
|
properties:
|
|
name:
|
|
type: string
|
|
title: name
|
|
description: The campaign's name.
|
|
campaign_identifier:
|
|
type: string
|
|
title: campaign_identifier
|
|
description: The campaign's identifier.
|
|
description:
|
|
type: string
|
|
title: description
|
|
description: The campaign's description.
|
|
budget:
|
|
type: object
|
|
description: >-
|
|
The campaign's budget which, when crossed, ends the
|
|
campaign.
|
|
required:
|
|
- type
|
|
- limit
|
|
- currency_code
|
|
properties:
|
|
type:
|
|
type: string
|
|
title: type
|
|
description: >
|
|
The budget's type. This can't be edited later. Use
|
|
`spend` to set a limit on the total amount discounted by
|
|
the campaign's promotions. Use `usage` to set a limit on
|
|
the total number of times the campaign's promotions can
|
|
be used.
|
|
enum:
|
|
- spend
|
|
- usage
|
|
limit:
|
|
type: number
|
|
title: limit
|
|
description: The campaign budget's limit.
|
|
currency_code:
|
|
type: string
|
|
title: currency_code
|
|
description: >-
|
|
The campaign budget's currency code. This can't be
|
|
edited later.
|
|
starts_at:
|
|
type: string
|
|
title: starts_at
|
|
description: The campaign's start date.
|
|
format: date-time
|
|
ends_at:
|
|
type: string
|
|
title: ends_at
|
|
description: The campaign's end date.
|
|
format: date-time
|
|
promotions:
|
|
type: array
|
|
description: The campaign's promotions.
|
|
items:
|
|
type: object
|
|
description: The promotions to add to the campaign.
|
|
required:
|
|
- id
|
|
properties:
|
|
id:
|
|
type: string
|
|
title: id
|
|
description: A promotion's ID.
|
|
- type: object
|
|
description: The campaign's details.
|
|
properties:
|
|
additional_data:
|
|
type: object
|
|
description: >-
|
|
Pass additional custom data to the API route. This data is
|
|
passed to the underlying workflow under the
|
|
`additional_data` parameter.
|
|
description: The campaign's details.
|
|
x-codeSamples:
|
|
- lang: JavaScript
|
|
label: JS SDK
|
|
source:
|
|
$ref: ../code_samples/JavaScript/admin_campaigns/post.js
|
|
- lang: Shell
|
|
label: cURL
|
|
source:
|
|
$ref: ../code_samples/Shell/admin_campaigns/post.sh
|
|
tags:
|
|
- Campaigns
|
|
responses:
|
|
'200':
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../components/schemas/AdminCampaignResponse.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
|
|
x-workflow: createCampaignsWorkflow
|
|
x-events: []
|