The DNSimple API client for Java.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
src WHOIS privacy renewal (renewWhoisPrivacy) (#12) Feb 1, 2019
.travis.yml Update repository path Oct 16, 2018
LICENSE.txt Merge branch 'release' Jan 28, 2018
VERSION Release 0.6.0 Feb 1, 2019
pom.xml Release 0.6.0 Feb 1, 2019

Java DNSimple API Wrapper

A Java client for the DNSimple API v2.

DNSimple provides DNS hosting and domain registration that is simple and friendly. We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.

⚠️ Alpha Warning

This project targets the development of the API client for the DNSimple API v2.

This library is currently in alpha version, the methods and the implementation should be considered a work-in-progress. Changes in the method naming, method signatures, public or internal APIs will happen during the alpha period.


This library is tested with Java 6 and later.

You must also have an activated DNSimple account to access the DNSimple API.



Add this dependency to your project's POM:



This library is a Java client you can use to interact with the DNSimple API v2.

The examples below demonstrate basic usage.

package myapp;

import com.dnsimple.Client;
import com.dnsimple.Account;
import com.dnsimple.response.WhoamiResponse;

public class MyApp {
  public static void main(String[] args) {
    Client client = new Client();
    WhoamiResponse response = client.identity.whoami();
    Account account = response.getData().getAccount();
    System.out.println("Account: " + account);

The user agent value will be prepended to additional user-agent information that is set by default in this library. While it is not strictly necessary to set the user agent, it is often helpful for the team at DNSimple when debugging, so please consider setting it.

Sandbox Usage

If you would like to test in the DNSimple sandbox environment then set the base URL:

package myapp;

import com.dnsimple.Dnsimple;
import com.dnsimple.Client;

public class MyApp {
  public static void main(String[] args) {
    Client client = new Client();
    // ...

You will need to ensure you are using an access token created in the sandbox environment. Production tokens will not work in the sandbox environment.

Stub for Testing

When developing unit tests for your application, you should stub responses from this client to avoid making any network calls.

You can use any mocking library you choose, however the examples below use Mockito.

Here is an example of a test demonstrating how to do mock the endpoint adapter:

public class MyTest {
  public void testSomething() throws DnsimpleException, IOException {
    Account account = new Account(1);

    EndpointAdapter adapter = mock(EndpointAdapter.class);
    when(adapter.identity().whoami()).thenReturn(new WhoamiResponse(new Whoami(account)));

    List<Domain> domains = new ArrayList<Domain>();
    domains.add(new Domain());
    when( ListDomainsResponse(domains));

    Client client = new Client(adapter);
    // ... your test