Beta Unofficial
Java SDK

Quick Links

How to Build

The generated code uses a few Maven dependencies e.g., Jackson, UniRest, and Apache HttpClient. The reference to these dependencies is already added in the pom.xml file will be installed automatically. Therefore, you will need internet access for a successful build.

  • In order to open the client library in Eclipse click on File -> Import.

Importing SDK into Eclipse - Step 1
Importing SDK into Eclipse - Step 1

  • In the import dialog, select Existing Java Project and click Next.

Importing SDK into Eclipse - Step 2
Importing SDK into Eclipse - Step 2

  • Browse to locate the folder containing the source code. Select the detected location of the project and click Finish.

Importing SDK into Eclipse - Step 3
Importing SDK into Eclipse - Step 3

  • Upon successful import, the project will be automatically built by Eclipse after automatically resolving the dependencies.

Importing SDK into Eclipse - Step 4
Importing SDK into Eclipse - Step 4

How to Use

The following section explains how to use the SecuritytextOrgAPI library in a new console project.

1. Starting a new project

For starting a new project, click the menu command File > New > Project.

Add a new project in Eclipse
Add a new project in Eclipse

Next, choose Maven > Maven Projectand click Next.

Create a new Maven Project - Step 1
Create a new Maven Project - Step 1

Here, make sure to use the current workspace by choosing Use default Workspace location, as shown in the picture below and click Next.

Create a new Maven Project - Step 2
Create a new Maven Project - Step 2

Following this, select the quick start project type to create a simple project with an existing class and a main method. To do this, choose maven-archetype-quickstart item from the list and click Next.

Create a new Maven Project - Step 3
Create a new Maven Project - Step 3

In the last step, provide a Group Id and Artifact Id as shown in the picture below and click Finish.

Create a new Maven Project - Step 4
Create a new Maven Project - Step 4

2. Add reference of the library project

The created Maven project manages its dependencies using its pom.xml file. In order to add a dependency on the SecuritytextOrgAPILib client library, double click on the pom.xml file in the Package Explorer. Opening the pom.xml file will render a graphical view on the cavas. Here, switch to the Dependencies tab and click the Add button as shown in the picture below.

Adding dependency to the client library - Step 1
Adding dependency to the client library - Step 1

Clicking the Add button will open a dialog where you need to specify SecuritytextOrgAPI in Group Id and SecuritytextOrgAPILib in the Artifact Id fields. Once added click OK. Save the pom.xml file.

Adding dependency to the client library - Step 2
Adding dependency to the client library - Step 2

3. Write sample code

Once the SimpleConsoleApp is created, a file named App.java will be visible in the Package Explorer with a main method. This is the entry point for the execution of the created project. Here, you can add code to initialize the client library and instantiate a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.

Adding dependency to the client library - Step 2
Adding dependency to the client library - Step 2

How to Test

The generated code and the server can be tested using automatically generated test cases. JUnit is used as the testing framework and test runner.

In Eclipse, for running the tests do the following:

  1. Select the project SecuritytextOrgAPILib from the package explorer.
  2. Select “Run -> Run as -> JUnit Test” or use “Alt + Shift + X” followed by “T” to run the Tests.

Initialization

API client can be initialized as following.


SecuritytextOrgAPIClient client = new SecuritytextOrgAPIClient();

Class Reference

List of Controllers

Class: WhoisController

Get singleton instance

The singleton instance of the WhoisController class can be accessed from the API Client.

WhoisController whois = client.getWhois();

Method: createApiWhoisQueryAsync

Tags: Skips Authentication

Query the server for a Domain object

void createApiWhoisQueryAsync(
        final RequestsQueryModel body,
        final APICallBack<ResponsesQueryModel> callBack)

Parameters

ParameterTagsDescription
bodyRequiredBody of API request

Example Usage

try {
    RequestsQueryModel body = new RequestsQueryModel();
    // Invoking the API call with sample inputs
    whois.createApiWhoisQueryAsync(body, new APICallBack<ResponsesQueryModel>() {
        public void onSuccess(HttpContext context, ResponsesQueryModel response) {
            // TODO success callback handler
        }
        public void onFailure(HttpContext context, Throwable error) {
            // TODO failure callback handler
        }
    });
} catch(JsonProcessingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Errors

Error CodeError Description
400Bad Request
406Not Acceptable
500Internal Server Error

Back to List of Controllers