Take Your Search Game to the Next Level with Dropbox Dash 🚀✨ Curious how it works? Ask us here!
Forum Discussion
rafstahelin
27 days agoNew member | Level 2
API Path Resolution Issue with Lambda Function
Dropbox Forum Post: API Path Resolution Issue with Lambda Function
The Problem I'm having an issue with my AWS Lambda function that uploads files from an S3 bucket to Dropbox. Despite using a token generated from my team account, all files are being uploaded to my personal account path with the team folder as a subfolder, rather than directly to the team space.
Current vs. Desired Behavior
- Current path: /personal_account/team_folder/ai/output/output-eagle.library/output-eagle/
- Desired path: /team_folder/ai/output/output-eagle.library/output-eagle/
Technical Implementation My Lambda function uses the standard Dropbox API to upload files:
python
response = http.request( 'POST', 'https://content.dropboxapi.com/2/files/upload', body=file_data, headers={ 'Authorization': f'Bearer {dropbox_token}', 'Content-Type': 'application/octet-stream', 'Dropbox-API-Arg': json.dumps({ 'path': f'/team_folder/ai/output/output-eagle.library/output-eagle/{filename}', 'mode': 'add', 'autorename': True }) } )
What I've Tried
- Created multiple tokens while logged into my team account
- Tried different path formats in the API call:
- /team_folder/path/to/folder
- //team_folder/path/to/folder
- /path/to/folder (without team folder prefix)
- Tried adding path_root parameter with namespace ID
- Linked team to the app in Developer Console
Interesting Observation When I use rclone with the same account credentials, I can access the team folder directly using the path /team_folder/... without any issues. This suggests I have the proper permissions, but something specific in the API implementation is causing the issue.
Questions
- How can I correctly specify a path to upload directly to my team space?
- Is there a specific header or parameter needed when using the API that rclone might be using automatically?
- Are different token types needed for accessing team spaces vs. personal spaces?
Any guidance would be greatly appreciated as this is for an automated workflow that transfers images from AWS to Dropbox for my team's use.
8 Replies
Sort By
- DB-Des21 days ago
Dropbox Community Moderator
Hi rafstahelin,
It looks like you have been in communication with our support team. We can continue assisting you through that channel.
- rafstahelin23 days agoNew member | Level 2
Is there any way to receive a more direct support on this matter. I am not an engineer and have been on this for a week. This is very difficult
- rafstahelin23 days agoNew member | Level 2
Progress So Far:
Critical Information Retrieved:
Obtained my root namespace ID: xxxxxxxx
Obtained my member ID: xxxxxxx
Added team_data.content.write and other team permissions to my appImplementation:
Successfully modified my AWS Lambda function to include both the namespace ID and member ID
Implemented the correct headers as advised
Updated my access token after adding the new permissions
Simplified the target path to /output-eagle/{filename} to eliminate potential path complexity issuesCurrent Issue:
Despite implementing all the recommended changes, I'm still receiving a "409 Conflict" error with the message:
{"error_summary": "path/no_write_permission/...", "error": {".tag": "path", "reason": {".tag": "no_write_permission"}, "upload_session_id": "pid_upload_session:ABIJH3zrQHGELnZnhSrIXYOcu2U9_8zfcTi0nbk8vg-kKQkKnA"}}
Current API Request Details:
python# Headers being sent:
headers = {
'Authorization': f'Bearer {dropbox_token}',
'Content-Type': 'application/octet-stream',
'Dropbox-API-Select-User': 'xxxxxxx',
'Dropbox-API-Path-Root': json.dumps({
".tag": "namespace_id",
"namespace_id": "xxxxxxxxx"
}),
'Dropbox-API-Arg': json.dumps({
'path': '/output-eagle/filename.jpg',
'mode': 'add',
'autorename': True,
'mute': False
})
}also tried:
headers = {
'Authorization': f'Bearer {access_token}',
'Dropbox-API-Select-User': member_id,
'Dropbox-API-Path-Root': json.dumps({
".tag": "root", # Changed from "namespace_id"
"root": root_namespace_id
}),
# Other headers...
}
I've confirmed that:My access token was refreshed after adding the permissions
I'm using the correct member ID and namespace ID
My app has the following permissions enabled:team_data.member
team_data.team_space
team_data.content.write
files.team_metadata.write
files.team_metadata.readWhat else should I check? Am I missing something in my implementation, or could there be a team-level permission issue that I need to address?
- DB-Des25 days ago
Dropbox Community Moderator
What you are wanting to retrieve from the response from the /2/users/get_current_account endpoint is the user's 'root_namespace_id'.
Feel free to share the response you are receiving so we can better assist. Please remove any personal identifiable information though.
- rafstahelin26 days agoNew member | Level 2
I've set these permissions:
- files.content.write
- files.content.read
- team_data.member
- team_data.content.write
- team_data.content.read
not sure what i am missing. - rafstahelin26 days agoNew member | Level 2
thanks for that. only thing is i cannot find my
i am running:curl -X POST https://api.dropboxapi.com/2/users/get_current_account \ --header "Authorization: Bearer YOUR_ACCESS_TOKEN"
but i am not getting my YOUR_NAMESPACE_ID back. is there another way of getting it?
- DB-Des26 days ago
Dropbox Community Moderator
Hi rafstahelin
To add to what jdalessio shared, by default, API calls to the Dropbox API operate in the "member folder" of the connected account, not the "team space". That means that by default, the contents of the team space will not be found.
You can configure API calls to operate in the "team space" instead though, in order to interact with files/folders in the team space. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on how to use this in the Team Files Guide.I hope you find this information helpful!
- jdalessio27 days ago
Dropbox Engineer
The developer documentation should cover your questions, see this article in paticular:
https://www.dropbox.com/developers/reference/path-root-header-modes
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,012 PostsLatest Activity: 34 minutes ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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!