cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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 API for Team Folder Operations

Java API for Team Folder Operations

himanshu_jha
Explorer | Level 3
Go to solution

Hi Team, 

 

I'm using dropbox V2 API with the Java library: dropbox-sdk-java 3.0.8. I would like to have features as below: User (who are part of team) can 

i.  List Team Folders, 

ii.  Create Folder inside Team Folder

iii.  Upload Files in Team Folders

 

My question is: 

1.  For all above functionality, I am using OAuth 2 access token created with a Dropbox API app key and not using Dropbox Business API app key. And all operations are working fine.

However, I am just wondering whether it is the right behaviour? Is it required to use token created using Dropbox Business API app key?

 

I am reffering these below links: 

https://www.dropbox.com/developers/reference/namespace-guidehttps://www.dropboxforum.com/t5/API-Support-Feedback/How-to-access-Team-Folders-with-Java-API/td-p/2...

 

2) Please find code for listing folders & uploading file:  Is it correct?

 DbxRequestConfig config = new DbxRequestConfig(clientIdentifier);
DbxClientV2 client = new DbxClientV2(config, accessToken);

FullAccount account = client.users().getCurrentAccount();
String rootNS = account.getRootInfo().getRootNamespaceId();

// Display Root Folders including TEAM Folders
ListFolderResult rootFolderResult = client.withPathRoot(PathRoot.root(rootNS)).files().listFolder(path);

// For Uploading File in Team folder
InputStream in = new FileInputStream(uploadFile);

FileMetadata metadata = dbxClient.files().uploadBuilder(dropboxPath)
.withMode(WriteMode.OVERWRITE)
.withClientModified(new Date(uploadFile.lastModified()))
.uploadAndFinish(in);

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

It sounds like you have the right idea, and your code looks fine.

For reference though, you don't need a Dropbox Business API app to perform these operations. You can also list and upload files using just a Dropbox API app (i.e., non-Business). The choice of what kind of app depends on your use case and requirements and is up to you.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

It sounds like you have the right idea, and your code looks fine.

For reference though, you don't need a Dropbox Business API app to perform these operations. You can also list and upload files using just a Dropbox API app (i.e., non-Business). The choice of what kind of app depends on your use case and requirements and is up to you.

himanshu_jha
Explorer | Level 3
Go to solution

Thank you Greg K. for quick response. 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    himanshu_jha Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?