-
Notifications
You must be signed in to change notification settings - Fork 2
Usage
Bert Kooij edited this page Sep 7, 2017
·
9 revisions
$client = new Client(
$username,
$password
);Replace $username and $password with the credentials you use to sign in at https://www.versio.nl/login?uri=/customer/. But please be aware for adding the credentials to a (public) Version Control System.
Please make sure that the IP Address of your server is added to the Versio Customer Portal at: https://www.versio.nl/customer/account/api.
The Client instance is providing a way to get the following instances:
-
categories()Category -
contacts()Contact -
dsnTemplates()DnsTemplate -
domains()Domain -
resellers()Reseller -
resellerPlans()ResellerPlan -
sslApprovers()SSLApprover -
sslCertificates()SSLCertificate -
sslProducts()SSLProduct -
tld()TLD -
webhosting()Webhosting -
webhostingPlans()WebhostingPlan
So for example you can run a request for listing the categories like this:
$client->categories()->list();Sync request
$categoryResponse = $client->categories->list();
if($categoryResponse->getStatusCode() == 200) {
$categories = json_decode($categoryResponse->getBody()->getContents());
} else {
// Error
}Async request
$client->categories->listAsync()->then(
function (ResponseInterface $response) {
// Success
$categories = json_decode($response->getBody()->getContents());
return $response;
},
// The failure callback
function (\Exception $exception) {
$error = json_decode($response->getBody()->getContents())->error;
print $error->message;
throw $exception;
}
);
There is an async and a sync version for all the requests.
| Code | Description | Versio API |
|---|---|---|
list() |
Returns a JSON list of all the categories | https://www.versio.nl/RESTapidoc/#api-Categories-List |
create(array $data) |
Creates a category based on the provided data | https://www.versio.nl/RESTapidoc/#api-Categories-Create |
delete($id) |
Deletetes the category based on the provided id | https://www.versio.nl/RESTapidoc/#api-Categories-Delete |