We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
dochdl
7 years agoHelpful | Level 6
Getting files from a non root namespace
Hi I want to be able to track all changes in all folders including in namespaces that are not a root user's root folder I use a team token. When I use /list_folder with the Dropbox-API-Select-...
- 7 years ago
So seems as if using Dropbox-Api-Select-Admin header solves the problem
However, it does not appear in your documentation
so the answer is using this request:
POST /2/files/list_folder
Host: https://api.dropboxapi.com
Authorization: Bearer <token>
Content-Type: application/json
Dropbox-Api-Select-Admin: dbmid:AAA...Rw
{
"path": "ns:2464786048",
"recursive": true
}
Greg-DB
Dropbox Staff
If you have a Dropbox Business API app with the "team member file access" permission, using /2/files/list_folder with the Dropbox-API-Select-User header and path="" and recursive=true is the right way to list the all of the contents of a user's account.
You can also specify a namespace in the path value instead. Check out the Namespace Guide for information on doing that.
Make sure you check the `has_more` value in the result returned by /2/files/list_folder though. If it's true, you need to call back to /2/files/list_folder/continue to get more entries.
If you want, you can register for webhooks to get notified of changes automatically. Be sure to check out the webhooks documentation for Business apps in particular too.
I'm not sure I understand your last question though. Can you clarify?
dochdl
7 years agoHelpful | Level 6
Hi
Thanks for the answer but it doesn't work
I got the namespace id from namespaces/list
Then I used list_files with path=ns:<namespace_id> and I fot path not found
The question about webhooks was how will I get the notification on a change in a shared\team folder. Will I get all the ids of all users in the notification? If so, is it a must? in that case I would prefer to poll changes in those folders.
Regarding the different path issue:
for ex:
let's say user1 adds 1 file to it's root folder and calls it file1
When I ask for list_folders with path="" for user1 the path I will get for it will be '/file1'
but the log event for the creation of the file will give me a different path '/user1/file1'
why is that?
- Greg-DB7 years agoDropbox Staff
For the issue listing the namespace by namespace ID, please share some sample code and full output so I can take a look.
Yes, if you register a Dropbox Business API app for team member file access notifications, you will get notified for changes to any member account. From the documentation:
"Note that a single change to a file in a shared folder will trigger a webhook for each user that the folder is shared with (and will also show up in the /list_folder entries for each account)."
Finally, the matter of the different paths sounds like a result of the new team space and member folders configuration. When you're using /2/files/list_folder[/continue] for a specific user, the paths are already relative to that member's folder. When you're using the audit log, on the other hand, the paths are relative to the team space itself, so it will contain the member folder name.
- dochdl7 years agoHelpful | Level 6
So I probably used a wrong token before
I did it again and now it's working, thanks! - dochdl7 years agoHelpful | Level 6So it wasn't a wrong token
It is working for the root directory of a user but not for other namespaces
for ex (from your api explorer):
POST /2/files/list_folder
Host: https://api.dropboxapi.com
User-Agent: api-explorer-client
Authorization: Bearer <token>
Content-Type: application/json
Dropbox-Api-Select-User: dbmid:AAA...Rw
{
"path": "ns:2464419056",
"recursive": true
}
returns results. this namespace is a root folder for the user in the header "Dropbox-Api-Select-User" (type=team_member_folder)
but this request returns path not found:
POST /2/files/list_folder
Host: https://api.dropboxapi.com
User-Agent: api-explorer-client
Authorization: Bearer <token>
Content-Type: application/json
Dropbox-Api-Select-User: dbmid:AAA...Rw
{
"path": "ns:2464786048",
"recursive": true
}
here it is the team's shared space (type=team_folder)
I get the same error for the default "Marketing" namespace (type=shared_folder)- dochdl7 years agoHelpful | Level 6
So seems as if using Dropbox-Api-Select-Admin header solves the problem
However, it does not appear in your documentation
so the answer is using this request:
POST /2/files/list_folder
Host: https://api.dropboxapi.com
Authorization: Bearer <token>
Content-Type: application/json
Dropbox-Api-Select-Admin: dbmid:AAA...Rw
{
"path": "ns:2464786048",
"recursive": true
}
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,878 PostsLatest Activity: 2 hours 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!