Table of Contents


Cloudera Manager(CM) 6.0 introduced new Java API client based on Swagger. This new API client supports all CM API versions.

Older Java client will still be supported for API version less than 30. So older Java API client can still be used against Cloudera Manager version 6.0 and later as long as API version 19 or earlier is used.

For example, you can use the old CM API client version 5.14 against CM version 6.0 which by default will invoke API version 19. If you want to use new features that were introduced in Cloudera Manager 6.0 (i.e. API version 30) like “Fine Grained Access Control” then you must use this new API client.

Older Java client and new Swagger based Java client can co-exist in an application to allow for incremental transition to new Swagger based java client.

NOTE: Beginning in API version 42, the types of some fields of Java API model objects have changed as compared with previous versions. Several fields that were previously represented as type BigDecimal have been migrated to type Integer. This applies to the new Swagger based Java client only.

Setting Up

Merge the following to your Maven project’s pom.xml:

      <name>Cloudera Repository</name>
      <version>7.2.4</version>  <!-- or CM version 6.0 and above -->

You can also directly download the jar(and sources) from the Cloudera repository.

SDK doc

Here is the latest SDK doc, for API version 43 (CM 7.2.4).

Basic Usage

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import com.cloudera.api.swagger.ClustersResourceApi;
import com.cloudera.api.swagger.client.ApiClient;
import com.cloudera.api.swagger.client.ApiException;
import com.cloudera.api.swagger.client.Configuration;
import com.cloudera.api.swagger.model.ApiCluster;
import com.cloudera.api.swagger.model.ApiClusterList;

public class ListClusters {

  public static void main(String[] args) throws IOException {
    ApiClient cmClient = Configuration.getDefaultApiClient();

    // Configure HTTP basic authorization: basic

    // Configure TLS for secure communication

    Path truststorePath = Paths.get("/path/to/ca_cert_file.pem");
    byte[] truststoreBytes = Files.readAllBytes(truststorePath);
    cmClient.setSslCaCert(new ByteArrayInputStream(truststoreBytes));

    ClustersResourceApi apiInstance = new ClustersResourceApi(cmClient);
    try {
      ApiClusterList clusterList = apiInstance.readClusters("ANY", "SUMMARY");
      for (ApiCluster cluster : clusterList.getItems()) {
        System.out.printf("Name: %s, Version: %s", cluster.getDisplayName(),
    } catch (ApiException e) {
      System.err.println("Exception when calling ClustersResourceApi#readClusters");

The above example invokes API over secure HTTPS channel. If TLS is not enabled on Cloudera Manager Admin Console then update the base path (setBasePath()) to point to right URL and TLS configuration (setVerifyingSSL(), setSslCaCert()) for API client can be dropped.