The Java SDK for Kloudless
Switch branches/tags
Nothing to show
Clone or download
vinodc Merge pull request #9 from psamsotha/readmelinks-fix
Fix source code links in README
Latest commit 0435fab Nov 30, 2017

Kloudless API Java Bindings

You can sign up for a Kloudless Developer account at


Java 1.8 and later.



Add this dependency to your project's POM:



Add this dependency to your project's build file:

compile 'com.kloudless:kloudless-java:1.1.0'


You'll need to manually install the Kloudless JAR, either by compiling it or downloading it from the Releases page


See for more examples.

User Impersonation can be seen found in or the example below:

HashMap<String, String> customHeaders = new HashMap<String, String>();
customHeaders.put("X-Kloudless-As-User", "<USER ID>");

Instantiating a Kloudless Client

The 1.1.0 version of the Kloudless Java SDK includes the KClient class, which allows you to instantiate a client with a specific bearer token and account id.

It is fairly basic to instantiate:

// Instantiation
KClient storageClient = new KClient("token12345", "accountID12345", null);

// Retrieve contents of Folder with id "root"
storageClient.contents(null, Folder.class, "root");

If you want to add user impersonation, the 3rd argument is for any additional headers that will be added to all requests.

See for more examples.


  • You can create the jar, skipping tests, with mvn install -DskipTests.
  • You can create a jar that includes dependencies with mvn compile assembly:single.
  • You can gather dependencies for easy installation/deployment with mvn dependency:copy-dependencies. They will be located in target/dependencies.


You must have Maven installed. To run the tests, simply run mvn test. Before tests, the API key or bearer token can be specified by using environment variables, program arguments, or the property file. The property file is required for tests.

Environment variables

API_KEY=keyValue mvn test
BEARER_TOKEN=tokenValue mvn test

Program arguments

mvn test -DapiKey=keyValue
mvn test -DbearerToken=tokenValue

You can run specific tests with the command-line argument -D test=Class#method. For example, -D test=KloudlessTest#testAccountAll.

Properties file

Before testing, please create a file called under the resources folder of the test project.

The API server to direct API requests to can be specified with this file. To use a custom server, direct traffic to it as shown below:

api_server_addr         = 
api_server_proto        = https 
api_server_port         = 443 

You can specify accounts to test with the test_accounts key in the properties file:

# multiple test accounts can be separated with a semi-colon
test_accounts = 1234; 5678; 91011

A Kloudless JSON Account object to test with can be included with the one_test_account_json key. The Account Metadata endpoint can be used to retrieve the JSON representation of the account.

test_one_test_account_json = {"id":1234,"service":.....}

The file to upload during tests can be specified as shown below: