95 lines
2.3 KiB
YAML
95 lines
2.3 KiB
YAML
get:
|
|
tags:
|
|
- Offers
|
|
security:
|
|
- ApiKeyAuth: []
|
|
summary: Get offers
|
|
description: Returns list of the offers
|
|
responses:
|
|
'200':
|
|
description: List of offers
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: ../schemas/Offer.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/offers');
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Api-Key: your-api-key'));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
echo curl_exec($ch);
|
|
post:
|
|
tags:
|
|
- Offers
|
|
security:
|
|
- ApiKeyAuth: []
|
|
summary: Create offer
|
|
description: Creates offer
|
|
requestBody:
|
|
description: Offer fields
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: ../schemas/OfferRequest.yaml
|
|
- $ref: ../schemas/OfferCreateRequired.yaml
|
|
responses:
|
|
'200':
|
|
description: Offer details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: ../schemas/Offer.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/offers');
|
|
|
|
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 Offer X',
|
|
|
|
'offer_type' => 'external',
|
|
|
|
'action_type' => 'http', // HTTP redirect
|
|
|
|
'action_payload' =>
|
|
'http://offer.com?ad_campaign_id={ad_campaign_id}&stream_id={stream_id}',
|
|
|
|
];
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
|
|
|
|
echo curl_exec($ch);
|