You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Kuki
6 years agoExplorer | Level 4
Unable to fecth files and folders from Team folders
I am using the Dropbox Business API and trying to fetch Folders and Files present into my team folder (If you will see I have created a "General Information" folder) (The folder which is out side of Member folders purpple color)
but I am not able to fetch anything using this API..
Although I can fetch all the files and folders present into Purpple color Folder(team member and Admin) but the folder which is outside of member folder creating issue.
I read your documentation and seacrhed lot of things but not find any solution.
Some where it is written that using namespaces it is possible, I tried with it as well but unsuccesfful.
Could ypu please tell me the exact code how to do it
The exact number of entries you get back per /2/files/list_folder[/continue] page is not guaranteed. Sometimes the API may return more entries per page, and sometimes it may return fewer.
Regardless of how many entries were returned, your app needs to always check the 'has_more' value and call back for more entries if it's 'true'.
- Greg-DBDropbox Staff
By default, API calls will operate inside your "member folder" (the purple folder), but you can configure them to operate in the "team space" (above the member folder) if you want. To do so, you need to set the 'Dropbox-API-Path-Root' header. You can find information on how to use that in the Namespace Guide here:
https://www.dropbox.com/developers/reference/namespace-guide
If something isn't working as expected, please share the code and unexpected output (but redact your access token).
- KukiExplorer | Level 4
Thank You for your reply: Please see my code and process I followed below:
1. STEP1: First I tried to find the the namespace ID's of the folder I have creared. I got the following output when I executed the API:
https://api.dropboxapi.com/2/team/namespaces/list
[namespaces] => Array
(
[0] => Array
(
[name] => Your team's shared workspace
[namespace_id] => 6131728736
[namespace_type] => Array
(
[.tag] => team_folder
))
[1] => Array
(
[name] => Sales
[namespace_id] => 6131729056
[namespace_type] => Array
(
[.tag] => shared_folder
))
[2] => Array
(
[name] => Custom_team_folder
[namespace_id] => 6512687312
[namespace_type] => Array
(
[.tag] => shared_folder
))
-----------------------------------------------------------------------------------------------
2. STEP2: Then I call this API https://api.dropboxapi.com/2/files/list_folder and passed the Namespace Id "6512687312" into my code, to get the list of files and folder present into the "Custom_team_folder" .
But I got this error:
"Operation completed without any errorsError in call to API function "files/list_folder":
This API function operates on a single Dropbox account, but the OAuth 2 access token you provided is for an entire Dropbox Business team. Since your API app key has team member file access permissions, you can operate on a team member's Dropbox by providing the "Dropbox-API-Select-User" HTTP header or "select_user" URL parameter to specify the exact user."Could I know How can I solve this error, why I am getting this error
This is My code: I used CURL using PHP:
<?php
$data = array("path"=>'');
$payload = json_encode($data);$ch = curl_init('https://api.dropboxapi.com/2/files/list_folder');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$payload);$headers = array(
'Content-type: application/json',
'Dropbox-API-Path-Root: {".tag": "namespace_id", "namespace_id": "6512687312"}',
'Authorization: Bearer <REDACTED>',
);curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
if(curl_exec($ch) === false)
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
$result_file_names = curl_exec($ch);
echo 'Operation completed without any errors';
}
print_r($result_file_names);
curl_close($ch);
exit;?>
Please see the screen shot for more reference:
----------------------------------------------------------------------------------------------------
I hope I will get the solution now.
- Greg-DBDropbox Staff
Thanks for the additional information. Please note that you should never share your access token like this. I've redacted it from your post, but you should revoke the token since you shared it publicly.
Anyway, you're getting this error because you're using an access token for an entire Business team to call a user-specific endpoint. You can do so, but you'll need to specify which team member to operate on. You can find information on how to do so under the "Member file access" section here:
https://www.dropbox.com/developers/documentation/http/teams#teams-member-file-access
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!