keitaro-api-skill/references/paths/campaigns_id_.yaml

146 lines
3.3 KiB
YAML

get:
tags:
- Campaigns
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
description: Campaign ID
required: true
schema:
type: integer
summary: Get campaign
description: Returns campaign information
responses:
'200':
description: Campaign information
content:
application/json:
schema:
$ref: ../schemas/Campaign.yaml
x-code-samples:
- lang: PHP
source: >-
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://example.com/admin_api/v1/campaigns/89');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
put:
tags:
- Campaigns
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
description: Campaign ID
required: true
schema:
type: integer
summary: Update campaign
description: Update a campaign
requestBody:
description: Fields to update
required: true
content:
application/json:
schema:
$ref: ../schemas/CampaignRequest.yaml
responses:
'200':
description: Update a Campaign
content:
application/json:
schema:
$ref: ../schemas/Campaign.yaml
'400':
$ref: ../responses/BadRequest.yaml
'401':
$ref: ../responses/Unauthorized.yaml
'402':
$ref: ../responses/PaymentRequired.yaml
'404':
$ref: ../responses/NotFound.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_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POST, 1);
$params = [
'name' => 'Test Campaign X2',
'alias' => 'test-campaign-x2',
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
echo curl_exec($ch);
delete:
tags:
- Campaigns
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
description: Campaign ID
required: true
schema:
type: integer
summary: Move campaign to archive
description: Moves campaign to archive
responses:
'201':
description: It's done
content:
application/json:
schema:
$ref: ../schemas/Domain.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/734');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
echo curl_exec($ch);