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

99 lines
2.4 KiB
YAML

get:
tags:
- Groups
security:
- ApiKeyAuth: []
parameters:
- name: type
in: query
description: Group type
required: true
schema:
type: string
default: campaigns
enum:
- campaigns
- offers
- landings
- domains
summary: Get groups
description: Returns list of the groups
responses:
'200':
description: List of the groups
content:
application/json:
schema:
type: array
items:
$ref: ../schemas/Group.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/groups?type=campaigns');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
post:
tags:
- Groups
security:
- ApiKeyAuth: []
summary: Create croup
description: Creates group.
requestBody:
description: Group fields.
required: true
content:
application/json:
schema:
allOf:
- $ref: ../schemas/GroupRequest.yaml
- $ref: ../schemas/GroupCreateRequired.yaml
responses:
'200':
description: Group details.
content:
application/json:
schema:
$ref: ../schemas/Group.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/groups');
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 Group X',
'position' => '10',
'type' => 'campaigns',
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
echo curl_exec($ch);