OTE Test Environment
{session.loggedInUser | ternary session.loggedInUser.fullName ''}
{session.loggedInUser | ternary session.loggedInUser.email ''}

Sign out

PHP Client

The PHP Client wraps the various calls to the Reseller REST API in an Object Oriented PHP library ready for integration into thirdparty applications.

You will need to have first activated the REST API in the control panel. This will provide you with API Keys and Secrets for both the ote and production environments. We strongly recommend that you connect to the OTE environment first and perform comprehensive testing of your software before using production.

Installation

The simplest method of installation is via composer

composer require netistrar/reseller-api

You may also checkout the latest version from GitHub here or download the latest source zip by clicking here

Basic Usage

The client provides a simple object oriented library for accessing all of the REST API methods. Assuming you have installed via composer you would create an API provider using the following code.

include "vendor/autoload.php";

use "Netistrar\ClientAPI\APIProvider";

$provider = new APIProvider("API_ENDPOINT_URL", "YOUR_API_KEY", "YOUR_API_SECRET");

The API_ENDPOINT_URL referenced above should be set to one of the following values:

OTE: https://restapi.netistrar-ote.uk

Production: https://restapi.netistrar.com

Your API Key and Secret can be looked up in My Account -> API Settings in the Netistrar control panel.

You can then access the various APIs using a convention which matches the REST path for each API as described in the API Reference guide

e.g. the ping method on the Utility API would be accessed using the following method on the provider object.


echo $provider->utility()->ping();

Descriptor Objects

Many of the API methods require complex structures which are supplied using descriptor objects. As many of these contain a number of optional properties these typically provide a full constructor with optional parameters as well as setter chaining for more terse object construction.

e.g. the hintedAvailability method on the Domains API accepts a DomainNameAvailabilityDescriptor object as it’s main object. This object only requires the searchString member to be supplied. Suppose you also wanted to set the suggestions boolean to true as well you could do either of the following.

$descriptor = new DomainNameAvailabilityDescriptor("test", null, null, true);

$results = $provider->domains()->hintedAvailability($descriptor);

or

$descriptor = (new DomainNameAvailabilityDescriptor)->setSearchString("test")->setSuggestions(true);

$results = $provider->domains()->hintedAvailability($descriptor);

Examples

You can download a comprehensive test/example script which demonstrates all of the key features of the API here.

Please Note: As the test script performs domain registrations and renewals it must only be run against the OTE environment.

Please refer to the API Reference guide for documentation on the various APIs available.


Top