cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

Java V2 - Equvalent to V1 API's

New member | Level 2
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
Highlighted

Re: Java V2 - Equvalent to V1 API's

Dropboxer
Dropboxer

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.

Highlighted

Re: Java V2 - Equvalent to V1 API's

New member | Level 2
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) {

Highlighted

Re: Java V2 - Equvalent to V1 API's

Dropboxer
Dropboxer

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.

Highlighted

Re: Java V2 - Equvalent to V1 API's

New member | Level 2
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.

Highlighted

Re: Java V2 - Equvalent to V1 API's

Dropboxer
Dropboxer

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.

Highlighted

Re: Java V2 - Equvalent to V1 API's

New member | Level 2
New member | Level 2

Oh.. cool

Highlighted

Re: Java V2 - Equvalent to V1 API's

New member | Level 2
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?

Highlighted

Re: Java V2 - Equvalent to V1 API's

New member | Level 2
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.

Highlighted

Re: Java V2 - Equvalent to V1 API's

Dropboxer
Dropboxer

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". 

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?