Table of Contents


Cloudera Manager(CM) 6.0 introduces 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 e.g. customer can use old CM API client version 5.14 against CM version 6.0 which by default will invoke API version 19. If customer wants to use new features that were introduced in Cloudera Manager 6.0 i.e. API version 30 like “Fine Grained Access Control” then customer 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.

Setting Up

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

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

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

SDK doc

Here is the latest SDK doc, for API version 32 (CM 6.2.0).

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("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.