Product WebAnalytics API
getAll()
Description
Returns the list of existing Web Analytics products.
Signature
getAll(Filter\Product\WebAnalytics\GetAll $filters = null): DataObject\Product\WebAnalytics\Existing[]
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Filter;
use Dreamscape\ResellerApiSdk\PredefinedValue;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$filters = Filter\Product\WebAnalytics\GetAll::build();
$filters->customerId = 123456;
$filters->statusId = 1;
$filters->limit = 10;
$filters->page = 1;
try {
$products = $api->products->webAnalytics->getAll($filters);
foreach ($products as $product) {
echo 'Product ID: ' . $product->id . PHP_EOL;
echo 'Domain Name: ' . $product->domainName . PHP_EOL;
}
echo 'Total items: ' . $products->totalItems . PHP_EOL;
echo 'Total pages: ' . $products->totalPages . PHP_EOL;
echo 'Current page: ' . $products->currentPage . PHP_EOL;
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
}
getDetails()
Description
Returns the details about single Web Analytics product.
Signature
getDetails(int $product_id): DataObject\Product\WebAnalytics\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Exception;
use Dreamscape\ResellerApiSdk\PredefinedValue;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
try {
$product = $api->products->webAnalytics->getDetails(123456);
echo 'Product ID: ' . $product->id . PHP_EOL;
echo 'Domain Name: ' . $product->domainName . PHP_EOL;
if ($product->statusId === PredefinedValue\Product::STATUS_REGISTERED) {
echo 'Product is registered' . PHP_EOL;
}
} catch (Exception\NotFoundException $e) {
// Handle the exception.
}
register()
Description
Registers new Web Analytics product.
Signature
register(DataObject\Product\WebAnalytics\Register $data_object): DataObject\Product\WebAnalytics\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;
use Dreamscape\ResellerApiSdk\PredefinedValue;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$new_product = DataObject\Product\WebAnalytics\Register::build()
->setCustomerId(123456)
->setDomainName('crazydomains.com.au')
->setPlanId(165)
->setPeriod(12);
try {
$product = $api->products->webAnalytics->register($new_product);
echo 'Product ID: ' . $product->id;
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\PaymentRequiredException $e) {
// Handle the exception.
}
renew()
Description
Renews Web Analytics product.
Signature
renew(int $product_id, DataObject\Product\WebAnalytics\Renew $data_object = null): DataObject\Product\WebAnalytics\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$renew_product = DataObject\Product\WebAnalytics\Renew::build();
$renew_product->period = 24;
try {
$product = $api->products->webAnalytics->renew(123456, $renew_product);
echo 'Product ID: ' . $product->id;
} catch (Exception\NotFoundException $e) {
// Handle the exception.
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\PaymentRequiredException $e) {
// Handle the exception.
}
terminate()
Description
Terminates Web Analytics product.
Signature
terminate(int $product_id): bool
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
try {
$api->products->webAnalytics->terminate(123456);
echo 'Product successfully terminated';
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\NotFoundException $e) {
// Handle the exception.
}