Skip to content
Bert Kooij edited this page Sep 7, 2017 · 9 revisions

Create Client Instance

$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.

Important: Whitelist IP Address

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.

Basic setup

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();

Using data

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.

Endpoints

Categories

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

Clone this wiki locally