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.