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.
CloudApp app = new CloudApp(APP_NAME, CLIENT_ID, CLIENT_SECRET, REDIRECT_URI); CloudClientContext context = new CloudClientContext(app, null); CloudClient client = new CloudClient(context);
Before you can start coding, you will need to:
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.
You will need:
In an editor, open the file BrowserController.java located in the following folder:
Update the following line in the CloudApp constructor with the values you have obtained from Key Management when you registered your app:
YOUR APP REDIRECT URI - change to HTTP callback address
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:
Run the command ant from the folder
The war file java-sdk-browser.war will be created in the target subdirectory.
Install the war file on your web app server and point your internet browser to the correct URL to run it.
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.