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
noelbuergler
5 months agoExplorer | Level 3
Target team folders without namespace
Hi, We are currently utilizing the Dropbox API to lock files within our team folder structure. For example, to lock the file located at: /Soft launch/_2024-06-17_Dropbox-Tests/2024-06-17_Dropbox-...
- 5 months ago
It looks like you're trying to operate on files inside the "team space". In order to access the team space, you do need to use the "Dropbox-API-Path-Root" header. It's not possible to access the contents of the team space without using the "Dropbox-API-Path-Root" header, but there are different ways to use the "Dropbox-API-Path-Root" header.
For example, you can use the "root" mode (instead of the "namespace_id" mode like you have in your sample) to access the root namespace for an account, which would be the team space for an account on a team using a team space configuration.
You can get the root_namespace_id for an account by calling /2/users/get_current_account for that account, and then plug that in to the "Dropbox-API-Path-Root" header on subsequent calls. You can find more information on how to use this functionality in the Team Files Guide.
When doing so, you should then supply the path value relative to that root. So for your example, that would look like:
curl -X POST https://api.dropboxapi.com/2/files/lock_file_batch \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -H "Dropbox-API-Select-User: YOUR_USER_ID" \ -H "Dropbox-API-Path-Root: {\".tag\": \"root\", \"root\": \"ROOT_NAMESPACE_ID\"}" \ -d '{ "entries": [ { "path": "/Soft launch/_2024-06-17_Dropbox-Tests/2024-06-17_Dropbox-Test Leerzeichen.indd" } ] }'
Greg-DB
5 months agoDropbox Staff
It looks like you're trying to operate on files inside the "team space". In order to access the team space, you do need to use the "Dropbox-API-Path-Root" header. It's not possible to access the contents of the team space without using the "Dropbox-API-Path-Root" header, but there are different ways to use the "Dropbox-API-Path-Root" header.
For example, you can use the "root" mode (instead of the "namespace_id" mode like you have in your sample) to access the root namespace for an account, which would be the team space for an account on a team using a team space configuration.
You can get the root_namespace_id for an account by calling /2/users/get_current_account for that account, and then plug that in to the "Dropbox-API-Path-Root" header on subsequent calls. You can find more information on how to use this functionality in the Team Files Guide.
When doing so, you should then supply the path value relative to that root. So for your example, that would look like:
curl -X POST https://api.dropboxapi.com/2/files/lock_file_batch \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Dropbox-API-Select-User: YOUR_USER_ID" \
-H "Dropbox-API-Path-Root: {\".tag\": \"root\", \"root\": \"ROOT_NAMESPACE_ID\"}" \
-d '{
"entries": [
{
"path": "/Soft launch/_2024-06-17_Dropbox-Tests/2024-06-17_Dropbox-Test Leerzeichen.indd"
}
]
}'
- noelbuergler5 months agoExplorer | Level 3
**bleep** Greg-DB you are awesome! Everything worked like a charm and it is exactly what I needed.
Regards,
Noel
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!