Getting Started with Java



Java SDK allows you to write Java applications to access Verizon Personal Cloud Storage user content (subject to the user's prior approval).

NOTE: Before you can download the Java SDK, you must first log on to ThingSpace Developer Portal and accept Verizon terms and conditions. If you start downloading the file without logging on, the download will stop and you will be redirected to the log on screen. Download will resume after a successful log on. Content uploaded through the Verizon Cloud website or the Verizon Cloud PC Desktop App is not yet available through the APIs.


The main class used by Java SDK is the class CloudClient. At runtime, a java application will typically construct and maintain CloudClient instances for each of its end users. To construct an instance of CloudClient, you will need a CloudClientContext object, which represents your app's Key and Secret, and a Verizon Personal Cloud Storage user's account information.

Code Sample

    CloudClientContext context = new CloudClientContext(app, null);                
    CloudClient client = new CloudClient(context);

Before You Begin

Before you can start coding, you will need to:

  1. Obtain Key, Secret, and Callback URL.
  2. Make sure you have the right tools.
  3. Install and set up Java SDK and Java Kepler File Explorer.

1. Obtain Key, Secret, and Callback URL

Key, Secret, and Callback URL are established during registration. If you have not yet registered, follow the steps on the Getting Credentials to Use the Personal Cloud Storage APIs page in the API Developer Guide to register.

NOTE: You application’s redirect URI will depend on your environment, such as in the example below. You can use the value localhost for host.


2. Make Sure You Have the Right Tools

You will need:

  • Java SDK version 1.7 or higher
  • ant to build
  • Framework for running web applications installed on your local machine, such as Apache HTTP Server, or Apache Tomcat

3. Install and Set up Java SDK and Java Kepler File Explorer

  1. Download Java SDK and Java Kepler File Explorer.
  2. In an editor, open the file located in the following folder:

  3. Update the following line in the CloudApp constructor with the values you have obtained from Key Management when you registered your app:

    • YOUR APP NAME - the name of your app specified in Key Management
    • YOUR APP CLIENT KEY - change to Key
    • YOUR APP CLIENT SECRET - change to Secret
    • YOUR APP REDIRECT URI - change to HTTP callback address

      Code Sample

      private static final CloudApp app = new CloudApp("YOUR_APP_NAME", "YOUR_APP_CLIENT_KEY", "YOUR_APP_CLIENT_SECRET", "YOUR_APP_REDIRECT_URI");

      The redirect URI must be URL-encoded.

      Update URI as described below:

    • From:

    • To:

  4. Compile the browser app.
  5. Run the command ant from the folder

  6. The war file java-sdk-browser.war will be created in the target subdirectory.

  7. Install the war file on your web app server and point your internet browser to the correct URL to run it.


How to Swap in a New HTTP Library

Out-of-the-box, the Verizon Personal Cloud Storage Java SDK uses Apache’s HttpClient library for HTTP calls. If needed, you can swap in a new library, by providing a new implementation of class HttpAdapter. HttpAdapter class includes get(), put(), post(), and delete() methods. You will need a new concrete implementation of this class which uses your preferred HTTP library. The methods of the HttpAdapter class return objects of type HttpResponse. HttpResponse is another abstract class which provides a generic wrapper for handling HTTP responses. If you chose to swap in a new library, you will also need a new concrete implementation of the HttpResponse class.

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.