cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Discuss Dropbox Developer & API

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

files api does not work

files api does not work

milousel
New member | Level 2

I creating app for uploading files into Dropbox. Right now I stuck working with files / folders inside Dropbox. By this tutorial I create this method for getting data about folders and create new folder inside Dropbox https://github.com/dropbox/dropbox-sdk-java, but it does not works. I can get data about my account, but when I try to get data about folders it stucks. I also already try to allow all file permissions in dropbox app settings.

private void createFolder() throws DbxException {
log.info("start createFolder");
FullAccount userData = clientV2.users().getCurrentAccount();
log.info("userData {}", userData.getName());
// Get files and folder metadata from Dropbox root directory
ListFolderResult result = clientV2.files().listFolder("");
while (true) {
for (Metadata metadata : result.getEntries()) {
log.info(metadata.getPathLower());
}

if (!result.getHasMore()) {
break;
}

result = clientV2.files().listFolderContinue(result.getCursor());
}
}

Response:

2024-05-02T17:05:32.800+02:00 INFO 33560 --- [mail] [Mail-EventQueue] com.example.mail.component.Monitor : start createFolder
2024-05-02T17:05:33.915+02:00 INFO 33560 --- [mail] [Mail-EventQueue] com.example.mail.component.Monitor : userData {"given_name":"Miloslav","surname":"Lejček","familiar_name":"Miloslav","display_name":"Miloslav Lejček","abbreviated_name":"ML"}

1 Reply 1

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/78419300/get-dropbox-folders-data ]

 

Based on your answer on StackOverflow, it sounds like you've already sorted this out. To confirm, scope changes on an app do not retroactively apply to existing access tokens.

 

Calling listFolder does require the "files.metadata.read" scope. If you attempt a call like that using an access token without the relevant scope granted though, you should get an exception raised, so you may want to check on how you're handling exceptions in your app to make sure you can see exceptions like that.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?