Files
medusa-store/www/apps/api-reference/specs/admin/paths/admin_campaigns.yaml
2024-08-18 16:55:04 +02:00

295 lines
9.6 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: expand
in: query
description: Comma-separated relations that should be expanded in the returned data.
required: false
schema:
type: string
title: expand
description: >-
Comma-separated relations that should be expanded in the returned
data.
- 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.
- 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.
- 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.
- 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: 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: SUMMARY
required:
- limit
- offset
- count
properties:
limit:
type: number
title: limit
description: The campaign's limit.
offset:
type: number
title: offset
description: The campaign's offset.
count:
type: number
title: count
description: The campaign's count.
- type: object
description: SUMMARY
required:
- campaigns
properties:
campaigns:
type: array
description: The campaign's 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: expand
in: query
description: Comma-separated relations that should be expanded in the returned data.
required: false
schema:
type: string
title: expand
description: >-
Comma-separated relations that should be expanded in the returned
data.
- 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.
- 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.
- 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.
- 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: []
requestBody:
content:
application/json:
schema:
allOf:
- type: object
description: SUMMARY
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 campaign identifier.
description:
type: string
title: description
description: The campaign's description.
budget:
type: object
description: The campaign's budget.
required:
- type
- limit
- currency_code
properties:
type:
type: string
enum:
- spend
- usage
limit:
type: number
title: limit
description: The budget's limit.
currency_code:
type: string
title: currency_code
description: The budget's currency code.
starts_at:
type: string
title: starts_at
description: The campaign's starts at.
format: date-time
ends_at:
type: string
title: ends_at
description: The campaign's ends at.
format: date-time
promotions:
type: array
description: The campaign's promotions.
items:
type: object
description: The promotion's promotions.
required:
- id
properties:
id:
type: string
title: id
description: The promotion's ID.
- type: object
description: SUMMARY
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: SUMMARY
x-codeSamples:
- 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