cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Re: v2 API

v2 API

Andre_LB
Explorer | Level 3

Hi Dropbox Team,

I am trying, using Dropbox API, to access my files in Dropbox.
I have already done it with Dropbox API v1 and now I would like to do it with v2.
For this reason, I performed as following:-

1) As suggested, I downloaded the new DropBox-SDK from here:-
https://github.com/dropbox/dropbox-sdk-java

2) I run the file:
..\DropboxApiV2\dropbox-sdk-java-master\gradlew.bat

3) I executed "Import Project" in the Android Studio, and selected the folder:
..\dropbox-sdk-java-master\examples\android

4) I added the following line in the build.gradle file in "dependencies" section:-
compile 'com.dropbox.core:dropbox-core-sdk:3.0.6'

5) But I have the following error:-
Unable to load class 'org.grangle.loading.StyledTextOutput'

Alsothe following lines are marked in red:-
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'

6) I have not yet updated "YOUR_APP_KEY_HERE" in AndroidManifest.xml with my app_key. For obtaining the app_key, in Dropbox Console, when I create the app_key
which name I have to give? Maybe "UserActivity"?

I need your help!
Thank you very much, in advance.
Andre

23 Replies 23

chirstius
Dropbox Staff

@Andre_LB,

 

Thanks for the update and I'm glad the steps presented here before have allowed you to get the example app working. I think you're taking the right next steps by comparing between the two (example, and your app) and finding what differences might be causing the issue.

 

We'll still be here if you need help with anything Dropbox specific, but it sounds like you're on a good path to getting things resolved.

 

Thanks!

 

-Chuck

Andre_LB
Explorer | Level 3

Hi Chuck,

thank you very much for your support: now my app is able to download and upload a file in my DropBox repository.

For being honest, I am not sure why before it did not work.

I tried to understand, but I would not be able, at the moment, to say why.

It is not important for me, but if it is for you, please, let me know and I could try to investigate.

 

At the moment, I am working in understanding how obtain FileMetadata information of a file.

Indeed I obtained the file revision of the downloaded one, by your example.

In other words, if I had not had from your example this information I would not be able to obtain it.

I tried to see in DropBox documentation, but I was not able to see anything.

 

mDbxClient.files().download(metadata.getPathLower(), metadata.getRev())
.download(outputStream);

That is, the .files().download() method needs the file path and revision. In the code it is obtained by metadata.

So, the kind question is: let us suppose to know the DropBox folder and file name.

How may I obtain its own FileMetadata metadata information?

 

Thank you very much, again.

Kind Regards,

Andrea

Greg-DB
Dropbox Staff

If you know the path to the file, you can get the file metadata using `files().getMetadata()`:

https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesReq...


By the way, if you just want to download the latest version of the file, you don't need to supply the 'rev' too. There's a version of the `files().download()` method that requires just the 'path' and not the 'rev':

 

https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/DbxUserFilesReq...

Andre_LB
Explorer | Level 3

Hi Greg,

yes, I have just tied and it works.

 

@ Greg, Chuck: thank you very much for your help.

     Now I may do, with API v2, what I need.

 

Kind Regards,

Andrea

Need more support?