-
Notifications
You must be signed in to change notification settings - Fork 2
/
GetProductDetails.php
26 lines (23 loc) · 1.09 KB
/
GetProductDetails.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include_once '../vendor/autoload.php';
$client = new \AutomaterSDK\Client\Client('YOUR_API_KEY', 'YOUR_API_SECRET');
try {
$product = $client->getProductDetails(1234); // your product ID
} catch (\AutomaterSDK\Exception\UnauthorizedException $exception) {
die('Invalid API key');
} catch (\AutomaterSDK\Exception\TooManyRequestsException $exception) {
die('Too many requests to Automater: ' . $exception->getMessage());
} catch (\AutomaterSDK\Exception\NotFoundException $exception) {
die('Not found - invalid params');
} catch (\AutomaterSDK\Exception\ApiException $exception) {
die($exception->getMessage());
}
echo 'Product ID: ' . $product->getId() . '<br>';
echo 'Status: ' . $product->getStatus() . '<br>';
echo 'Price: ' . $product->getPrice() . '<br>';
echo 'Currency: ' . $product->getCurrency() . '<br>';
echo 'Name: ' . $product->getName() . '<br>';
echo 'Description: ' . $product->getDescription() . '<br>';
echo 'Type: ' . $product->getType() . '<br>';
echo 'Database ID: ' . $product->getDatabaseId() . '<br>';
echo 'Available codes: ' . $product->getAvailableCodes() . '<br>';