109 lines
2.5 KiB
YAML
109 lines
2.5 KiB
YAML
get:
|
|
tags:
|
|
- Campaigns
|
|
security:
|
|
- ApiKeyAuth: []
|
|
summary: Get all campaigns
|
|
description: Returns the campaigns
|
|
parameters:
|
|
- in: query
|
|
name: offset
|
|
schema:
|
|
type: integer
|
|
description: >-
|
|
The number of campaigns to skip before starting to collect the result
|
|
set.
|
|
- in: query
|
|
name: limit
|
|
schema:
|
|
type: integer
|
|
description: The numbers of campaigns to return.
|
|
responses:
|
|
'200':
|
|
description: Campaigns
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: ../schemas/Campaign.yaml
|
|
'400':
|
|
$ref: ../responses/BadRequest.yaml
|
|
'401':
|
|
$ref: ../responses/Unauthorized.yaml
|
|
'402':
|
|
$ref: ../responses/PaymentRequired.yaml
|
|
'500':
|
|
$ref: ../responses/InternalError.yaml
|
|
x-code-samples:
|
|
- lang: PHP
|
|
source: >-
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL,
|
|
'http://example.com/admin_api/v1/campaigns');
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
echo curl_exec($ch);
|
|
post:
|
|
tags:
|
|
- Campaigns
|
|
security:
|
|
- ApiKeyAuth: []
|
|
summary: Create campaign
|
|
description: Creates campaign
|
|
requestBody:
|
|
description: Creates campaign
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: ../schemas/CampaignRequest.yaml
|
|
- $ref: ../schemas/CampaignCreateRequired.yaml
|
|
responses:
|
|
'200':
|
|
description: Campaign details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../schemas/Campaign.yaml
|
|
'400':
|
|
$ref: ../responses/BadRequest.yaml
|
|
'401':
|
|
$ref: ../responses/Unauthorized.yaml
|
|
'402':
|
|
$ref: ../responses/PaymentRequired.yaml
|
|
'406':
|
|
$ref: ../responses/NotAcceptable.yaml
|
|
'500':
|
|
$ref: ../responses/InternalError.yaml
|
|
x-code-samples:
|
|
- lang: PHP
|
|
source: >-
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL,
|
|
'http://example.com/admin_api/v1/campaigns');
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
|
$params = [
|
|
|
|
'name' => 'Test Campaign X',
|
|
|
|
'alias' => 'test-campaign-x',
|
|
|
|
];
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
|
|
|
|
echo curl_exec($ch);
|