cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Create a Folder in a Team's Shared WorkSpace

Create a Folder in a Team's Shared WorkSpace

Lodgical
Explorer | Level 3

Hi,  please can you help.

I am using the following post to try to create a folder inside the "Scanned Docs" Folder shown belowimage.png

 

 

 

 

 

 

URL = https://api.dropboxapi.com/2/files/create_folder_v2

Contents of my Post = 

--header "Authorization: Bearer <<dropbox_token>>" \
--header "Dropbox-API-Select-Admin: <<TEAM_MEMBER_ID>>" \
--header 'Dropbox-API-Path-Root: {".tag": "root", "root": : "84********"} \
--header "Content-Type: application/json" \
--data "{\"path\": \"<<file_path>>\",\"autorename\": false}"

I have tried every permutation I can think of in the 'Dropbox-API-Path-Root (including "Home" and "namespace_id" options and numbers 1-7 in the id. The number starting with 84 above is the namespace_id for the base directory called "Lodgical's Shared Workspace" as derived from a "https://api.dropboxapi.com/2/team/team_folder/list" post. The "<<TEAM_MEMBER>> was discovered by using a "https://api.dropboxapi.com/2/team/members/list" and returned: a dbmid with a tag of "team_admin".

 

I am using a new API app with "scoped" permissions and have pretty much every setting ticked as active

 

Pretty much everytime I think I have the syntax right etc I get the error: {"error_summary": "path/no_write_permission/..", "error": {".tag": "path", "path": {".tag": "no_write_permission"}}}

 

Everytime I switch to try the Dropbox-API-Select-User header instead - it creates the folder I want but inside the "Paul Lodge" Home Space.

I have read the namespace documentation etc from top to bottom, I can't quite work out what piece of the puzzle I am notting getting right. Can you please help?

2 Replies 2

Greg-DB
Dropbox Staff

It sounds like you have the right idea here, but note that the 1-7 numbers in the guide you're referring to are just examples; you shouldn't actually be using those real calls.

 

Using the ID of the "Shared Workspace" as you mentioned (apparently starting with "84..." in your case) as the "root" in the "Dropbox-API-Path-Root" header is the right way to write in the team space though. And you would put the "Scanned Docs" path component in 'path' variable, along with the name of the new folder you want to create.

 

So, to summarize, your call should look like this:

curl -X "POST" https://api.dropboxapi.com/2/files/create_folder_v2 \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Select-Admin: dbmid:..." \
    --header 'Dropbox-API-Path-Root: {".tag": "root", "root": "84..."}' \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"/Scanned Docs/NEW_FOLDER_NAME\",\"autorename\": false}"

It sounds like you've already tried that though, and still got an error, or created the folder in the team member folder instead. I recommend double checking that you've copied the right ID though, as the IDs for different areas in the same account can look similar, e.g., may both start with "84..." in your case.

 

If this still isn't working for you, we'll be happy to take a closer like, but we'd need to see the actual values you're sending. In that case, please open a ticket with the code you're using, including the actual values (but please redact your access token) so we can check on that for you.

 

Lodgical
Explorer | Level 3

Thank you Greg,

 

I have tried again using the exact Post you suggested. I had already tried that Post but gave it another go.

 

I checked the "84" id and - assuming I am collecting it in the correct way - I had definately copied the number across correctly (i.e. no typo's). I double checked the dbmid too.

 

I have opened a ticket per your suggestion.

Need more support?