The Java 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
For Maven add the following dependency to your pom.xml file
<dependency>
<groupId>com.netistrar</groupId>
<artifactId>reseller-api</artifactId>
<version>1.34</version>
</dependency>
For all other environments please download and install the following JARs in your enviornment
-
the latest Netistrar Reseller API JAR from here
-
Google GSON from https://github.com/google/gson
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.
import com.google.gson.Gson;
import netistrar.clientapi.APIProvider;
String endpoint = "API_ENDPOINT_URL";
String apiKey = "YOURAPIKEY";
String apiSecret = "YOURAPISECRET";
APIProvider provider = new APIProvider(endpoint, apiKey, apiSecret);
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.
provider.utility().ping();
Note on 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 blank and a full constructor for all properties 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.
DomainNameAvailabilityDescriptor descriptor = new DomainNameAvailabilityDescriptor("test", null, null, true, null);
DomainAvailabilityResults results = provider.domains().hintedAvailability($descriptor);
or
DomainNameAvailabilityDescriptor descriptor = new DomainNameAvailabilityDescriptor().setSearchString("test").setSuggestions(true);
DomainAvailabilityResults 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.