Hello,
I need to upload files using API to a folder that is outside of my current user account (the user ID I’m logged in with).
However, when using the API, the folder structure is being created within my user folder instead of uploading to the existing target folder. How can I upload files to these other folders?
For example:
Thanks
Hi @deeptir94,
Your issue is related to the fact that API default access start from users home folder. While for individual users their home is their account root, for business user home folder (the your folder starting with "svc" as seems) is not account root (or at least not mandatory to be - in most cases these days, it is NOT). In business accounts, you need to set the account root explicitly to override the default home folder when you need (like in your case). This happens using HTTP header "Dropbox-API-Path-Root" set to appropriate namespace id (the root namespace id in your case, but you can set any other namespace id if you want that namespace to be your access root). Take a look here (and linked resources there) for additional details. Use appropriate method if you use some of the supported SDKs.
Hope this helps.
Dropbox-Api-Path-Root: {".tag": "root", "root": "YOUR_ROOT_NAMESPACE_ID"}
Hello, thanks for your reply.
I am still not sure how to fetch the namespace id for my folder. The API calls return information regarding the default root folder.
In most cases, setting the account root namespace id is enough since in such a way you can access everything accessible to particular user. So maybe it's the best way for you too. If you want to select from other available namespaces, you can enumerate them using /2/team/namespaces/list/continue.
Hope this sheds a light.