Skip to content
Frostman edited this page Apr 26, 2012 · 15 revisions

Dropbox4j - Dropbox API Java implementation licensed with Apache License v.2

Dropbox4j makes it easier to download, upload, move, copy, delete and etc files in Dropbox. It supports for web authentication (with authorization url) and mobile authentication (with user's credentials). All returned by Dropbox4j data are POJOs or helpers, so you have no problems with working with them using GWT and etc.

Version

Current stable version: 0.2

Current snapshot version: 0.3-SNAPSHOT

Links to official Dropbox API description:

Short app using Dropbox4j

To get ready to use DropboxClient you should do one of operations:

  • Using web auth (by url)
WebAuthentication auth = DropboxClientBuilder.build(APP_KEY, APP_SECRET).web("https://www.frostman.ru/dp");
System.out.println("Auth url:\n" + auth.getAuthorizationUrl() + "\nPress any key after accepting app");
new Scanner(System.in).nextLine();
DropboxClient client = auth.receiveAccessToken();
  • Using user's credentials
DropboxClient client = DropboxClientBuilder.build(APP_KEY, APP_SECRET).mobile().authenticate(email, password);
  • Using existing access token
DropboxClient client = DropboxClientBuilder.build(APP_KEY, APP_SECRET, ACCESS_TOKEN, ACCESS_SECRET);

Now when you have instance of DropboxClient you can make operations ith your Dropbox account. You can find description of each of the supported operations in javadocs for methods of class DropboxClient.

There is some of the operations:

  • copy(File from, File to)
  • putFile(File file, String path)
  • getFile(String path)

etc

All of the descripted at official Dropbox API page methods are supported. Some additional methods will be added soon.

Errors

All non 200 http codes will be returned as throwing DropboxHttpCodeException that will contains http code and long message if exists.

Roadmap

  • Add artifact to maven central repo.
  • Implement additional API methods (if find info about them).

Maven

Releases repo: Maven central sync from https://oss.sonatype.org/content/repositories/releases/

<dependency>
    <groupId>ru.frostman.dropbox</groupId>
    <artifactId>dropbox4j</artifactId>
    <version>VERSION</version>
</dependency>

Snapshots repo: https://oss.sonatype.org/content/repositories/snapshots/

<repository>
    <id>OSS Sonatype Snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>