This is the reference for the Java client to Cloduera Manager (CM).
While the CM API is defined as a RESTful HTTP API, using JSON objects for requests and responses, you rarely need to interact with the HTTP or JSON layer as a user of the Java client. The Java client is a proxy, built from the same JAX-RS interface that defines the server-side implementation.
The main entry point to the Java client is via the
ClouderaManagerClientBuilder
. For example:
RootResourceV3 apiRoot = new ClouderaManagerClientBuilder()
.withHost("your.cm.com")
.withUsernamePassword("admin", "admin")
.build()
.getRootV3();
In the snippet above, the final call to getRootV3()
returns
a RootResourceV3.
Alternatively, a call to getRootV2()
would return the v2
equivalent.
You should use the version that corresponds to your CM
installation, which you can find out by accessing
http://your.cm.com:7180/api/version
.
Within the same major version of CM, API support is backwards compatible. For example, CM 4.5 introduces API v3, and it also accepts API requests of v1 (CM 4.0) and v2 (CM 4.1).
Upon errors, the client will throw exceptions with HTTP error codes in the 400s and 500s: