Java Client

Step 1 - Add the Client with the Package Manager

Add the Java client to your Maven POM file:

Add a reference to the repository (we use Jitpack to dynamically compile the library from Github source):

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

Add a reference to the dependency:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.62</version>
</dependency>
</dependencies>

Step 2 - Create an API Client object with API Key

Import the API Client package by adding this line to the top of your .java file:

import com.cloudmersive.client.invoker.ApiClient;
import com.cloudmersive.client.invoker.ApiException;
import com.cloudmersive.client.invoker.Configuration;
import com.cloudmersive.client.invoker.auth.*;
import com.cloudmersive.client.ConvertDocumentApi;
 

Get your API Key (available in your Account Dashboard) and instantiate the API Client object:

ApiClient defaultClient = Configuration.getDefaultApiClient();

ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");


Step 3 - Call an API

Let's try calling the email validation API to check if this email address exists:
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
File inputFile = new File("C:\\temp\\input.docx"); // File | Input file to perform the operation on.
try {
    byte[] result = apiInstance.convertDocumentDocxToPdf(inputFile);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ConvertDocumentApi#convertDocumentDocxToPdf");
    e.printStackTrace();
}


Sample Application

Download Console Sample or Download Android Sample

You can also download our sample application from GitHub.

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency:

dependencies {
        implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java:v3.62'
}

Step 2 - Create an API Client object with API Key

Import the API Client package by adding this line to the top of your .java file:

import com.cloudmersive.client.invoker.ApiClient;
import com.cloudmersive.client.invoker.ApiException;
import com.cloudmersive.client.invoker.Configuration;
import com.cloudmersive.client.invoker.auth.*;
import com.cloudmersive.client.ConvertDocumentApi;
 

Get your API Key (available in your Account Dashboard) and instantiate the API Client object:

ApiClient defaultClient = Configuration.getDefaultApiClient();

ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");


Step 3 - Call an API

Let's try calling the email validation API to check if this email address exists:
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
File inputFile = new File("C:\\temp\\input.docx"); // File | Input file to perform the operation on.
try {
    byte[] result = apiInstance.convertDocumentDocxToPdf(inputFile);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ConvertDocumentApi#convertDocumentDocxToPdf");
    e.printStackTrace();
}


Sample Application

Download Console Sample or Download Android Sample

You can also download our sample application from GitHub.

Add the Java client to your Maven POM file:

Add a reference to the repository (we use Jitpack to dynamically compile the library from Github source):

<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>

Add a reference to the dependency:

<dependency>
	<groupId>com.github.Cloudmersive</groupId>
	<artifactId>Cloudmersive.APIClient.Java.RestTemplate</artifactId>
	<version>4.0.2</version>
</dependency>

Step 2 - Create an API Client object with API Key

Import the API Client package by adding this line to the top of your .java file:

import com.cloudmersive.client.rt.invoker.ApiClient;
import com.cloudmersive.client.rt.invoker.ApiException;
import com.cloudmersive.client.rt.invoker.Configuration;
import com.cloudmersive.client.rt.invoker.auth.*;
import com.cloudmersive.client.rt.invoker.models.*;
import com.cloudmersive.client.rt.ScanApi;
 

Get your API Key (available in your Account Dashboard) and instantiate the API Client object:

ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.cloudmersive.com");

// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");

ScanApi apiInstance = new ScanApi(defaultClient);
File inputFile = new File("/path/to/file"); // File | Input file to perform the operation on.
try {
	VirusScanResult result = apiInstance.scanFile(inputFile);
	System.out.println(result);
} catch (ApiException e) {
	System.err.println("Exception when calling ScanApi#scanFile");
	System.err.println("Status code: " + e.getCode());
	System.err.println("Reason: " + e.getResponseBody());
	System.err.println("Response headers: " + e.getResponseHeaders());
	e.printStackTrace();
}


Sample Application

Download Console Sample or Download Android Sample

You can also download our sample application from GitHub.

Add the Java client to your Maven POM file:

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency:

dependencies {
	implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java.RestTemplate:4.0.2'
}

Step 2 - Create an API Client object with API Key

Import the API Client package by adding this line to the top of your .java file:

import com.cloudmersive.client.rt.invoker.ApiClient;
import com.cloudmersive.client.rt.invoker.ApiException;
import com.cloudmersive.client.rt.invoker.Configuration;
import com.cloudmersive.client.rt.invoker.auth.*;
import com.cloudmersive.client.rt.invoker.models.*;
import com.cloudmersive.client.rt.ScanApi;
 

Get your API Key (available in your Account Dashboard) and instantiate the API Client object:

ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.cloudmersive.com");

// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");

ScanApi apiInstance = new ScanApi(defaultClient);
File inputFile = new File("/path/to/file"); // File | Input file to perform the operation on.
try {
	VirusScanResult result = apiInstance.scanFile(inputFile);
	System.out.println(result);
} catch (ApiException e) {
	System.err.println("Exception when calling ScanApi#scanFile");
	System.err.println("Status code: " + e.getCode());
	System.err.println("Reason: " + e.getResponseBody());
	System.err.println("Response headers: " + e.getResponseHeaders());
	e.printStackTrace();
}


Sample Application

Download Console Sample or Download Android Sample

You can also download our sample application from GitHub.


800 free API calls/month, no credit card required

Get started now!