(advertisements)
Get an advertisement campaign by ID.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->advertisements->get(
id: '<value>'
);
if ($response->advertisementCampaign !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The advertisement campaign ID. |
?Operations\AdvertisementsGetResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List active advertisement campaigns for a benefit.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$responses = $sdk->advertisements->list(
benefitId: '<value>',
page: 1,
limit: 10,
sorting: [
Components\AdvertisementSortProperty::Clicks,
]
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
benefitId |
string | ✔️ | N/A |
page |
?int | ➖ | Page number, defaults to 1. |
limit |
?int | ➖ | Size of a page, defaults to 10. Maximum is 100. |
sorting |
array<Components\AdvertisementSortProperty> | ➖ | Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order. |
?Operations\AdvertisementsListResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |