-
Notifications
You must be signed in to change notification settings - Fork 2
/
CreateDatabase.php
23 lines (19 loc) · 1000 Bytes
/
CreateDatabase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
include_once '../vendor/autoload.php';
$client = new \AutomaterSDK\Client\Client('YOUR_API_KEY', 'YOUR_API_SECRET');
$createDatabaseRequest = new \AutomaterSDK\Request\CreateDatabaseRequest();
$createDatabaseRequest->setName("test database");
$createDatabaseRequest->setType(\AutomaterSDK\Request\CreateDatabaseRequest::TYPE_STANDARD);
try {
$createDatabaseResponse = $client->createDatabase($createDatabaseRequest);
} catch (\AutomaterSDK\Exception\UnauthorizedException $exception) {
die('Invalid API key or API secret');
} 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) {
var_dump($exception->getValidationErrors());
die($exception->getMessage());
}
echo 'Created database ID: ' . $createDatabaseResponse->getId();