cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java V2 - Equvalent to V1 API's

Java V2 - Equvalent to V1 API's

Joel T.9
New member | Level 2

I'm looking for the following API's that exist in V1:

1) client.getDelta(deltaCursor)
2) client.createTemporaryDirectUrl(path)
3) client.disableAccessToken()

For the first one, getDelta, it appears this would be equivalent:
ListFolderResult result = client.files().listFolderContinue(deltaCursor);

However, I couldn't tell how to determine if an entry was deleted, the previous API I used DbxEntry.metadata == null.

For 2&3, maybe using the old API is supported still? The only reason I need the new API is to use the file ID support mostly for detecting file renames.

10 Replies 10

Greg-DB
Dropbox Staff

1) Yes, in API v2, you would use listFolder and listFolderContinue instead of getDelta. You should check if each entry is a FileMetadata, FolderMetadata, or DeletedMetadata to distinguish between files, folders, and deleted items, respectively.

2) API v2 doesn't currently have an equivalent of createTemporaryDirectUrl, but I'll be sure to pass this along as a feature request.

3) API v2 also doesn't currently have an equivalent of disableAccessToken, but I'll be sure to pass this along as a feature request too.

And yes, for the functionality without equivalents in API v2, you can continue using v1.

Joel T.9
New member | Level 2

Thanks for the quick response. Having a DeletedMetadata makes sense. I was however surprised that DeletedMetadata doesn't have a getId() for the item being deleted.

Is there an equivalent for "page reset" in V2?

    DbxDelta<DbxEntry> page = client.getDelta(deltaCursor);
    if (page.reset) {

Greg-DB
Dropbox Staff

That's correct, DeletedMetadata doesn't contain a file ID, but we'll consider this a feature request as well.

And yes, listFolderContinue can raise ListFolderContinueErrorException where ListFolderContinueError.RESET would indicate a reset, in which case you should start over with listFolder.

Joel T.9
New member | Level 2

DeletedMetadata.getId() makes more sense to me, fortunately, I have a workaround.

My only issue remaining is compiling with maven while trying to support both versions at the same time, because the SDK names are identical (between 1.8.1 & 2.0.0). A question for the maven forums, on how to allow both to be used.

Greg-DB
Dropbox Staff

Unless I misunderstand your scenario, you shouldn't need to include both. The 2.0.0 version also include the API v1 calls that 1.8.1 has. I.e., it contains both DbxClientV1 and DbxClientV2.

Joel T.9
New member | Level 2

Oh.. cool

Joel T.9
New member | Level 2

I see the main thing changed for the V1 API is the exceptions. They convert pretty straight-forward, except for one: DbxException.BadResponse

Is that now ProtocolException?

Joel T.9
New member | Level 2

Also, I was disappointed. When I rename a file it sends a delete followed by an "add". I was expecting the new API to only report a "modify" to the given file id.

Greg-DB
Dropbox Staff

Do you mean com.dropbox.core.BadResponseException? Each method should document the exceptions it can through. For example, the new download method can throw IllegalArgumentException, DownloadErrorException, or DbxException. For example, it would throw IllegalArgumentException if a parameter is in the wrong format, e.g., "test.txt" instead of "/test.txt". 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Joel T.9 New member | Level 2
What do Dropbox user levels mean?