# Summary
I used the "/2/files/upload" endpoint of the Dropbox API.
However, the file is uploaded to your personal folder.
I want to upload files to the team folder using the API.
# Tried
I found the following questions.
https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Access-team-folders-of-bussines-plan-with-Folder-Files/td-p/268044
It says "Use Dropbox-API-Path-Root".
The Dropbox-API-Path-Root requires Namespace.
So I used Dropbox API Explorer • namespaces/list to find the Namespace of the folder I wanted to upload.
I found the desired value in the data returned by Dropbox API Explorer.
{
"name": "FOLDER_NAME",
"namespace_id": "xxxxxxxxxx",
"namespace_type": {
".tag": "shared_folder"
}
},
So I added the following code to PHP's program processing.
This is written in the header section of Guzzle.
$header = [
'Authorization' => 'Bearer ' . ACCESS_TOKEN,
'Content-Type' => 'application/octet-stream',
'Dropbox-API-Path-Root' => json_encode([
'.tag' => 'shared_folder',
'shared_folder' => 'namespace_id(xxxxxxxxxx)'
]),
'Dropbox-API-Arg' => json_encode([
'path' => '/example/upload/',
'mode' => 'add',
'autorename' => true,
'mute' => false,
'strict_conflict' => false,
]),
];
However, I get a ".tag shared_folder does not exist" error.
There was an error when I changed to '.tag' => 'root'.
Why is this?
Please tell me how to do it.
Thank you.