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

101 lines
2.2 KiB
YAML

get:
tags:
- Offers
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
description: Offer ID
required: true
schema:
type: integer
summary: Get offer
description: Returns offer
responses:
'200':
description: Offer
content:
application/json:
schema:
$ref: ../schemas/Offer.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
put:
tags:
- Offers
security:
- ApiKeyAuth: []
parameters:
- name: id
in: path
description: Offer ID
required: true
schema:
type: integer
summary: Update offer
description: Updates offer
requestBody:
description: Update an Offer
required: true
content:
application/json:
schema:
$ref: ../schemas/OfferRequest.yaml
responses:
'200':
description: Offer
content:
application/json:
schema:
$ref: ../schemas/Offer.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/offers/16');
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 Offer X2',
'offer_type' => 'external',
'action_type' => 'http', // HTTP redirect
'action_payload' => 'http://offer.com?ad_campaign_id={ad_campaign_id}'
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
echo curl_exec($ch);