cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

get_metadata endpoint cannot find valid namespace IDs

get_metadata endpoint cannot find valid namespace IDs

joshuacole
New member | Level 2

I am currently iterating over a list of all namespace IDs from a given teamroom.

When i supply these namespace IDs to the files/list_folder endpoint, I recieve a valid response of all files found within that namespace, so the namespace ID is valid. However when i supply the same namespace ID to the files/get_metadata endpoint, I receive a 409 response with the following message:

'{"error_summary": "path/not_found/.", "error": {".tag": "path", "path":{".tag": "not_found"}}}

Why can the files/listfolder successfully find the folder using the namespace id as a path, but the files/get_metadata endpoint cannot? The documentation states that namespace IDs should be valid paths when supplied to the get_metadata endpoint:

path String(pattern="(/(.|[\r\n])*|id:.* )|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.* )?)") The path of a file or folder on Dropbox.

 

1 Reply 1

Greg-DB
Dropbox Staff

Are the namespace IDs for the team members' home folders?

By default, API calls operate using the member's home folder as the "root", but you can't retrieve the metadata for"root". So, while the folders have contents that can be listed, you can't retrieve the metadata for the folder itself.

For teams using the team space though, you can optionally set the "root" for an API call to be the team space's root, in which case you can retrieve the metadata for the user's folder under that team space root. You can find information on how to do so in the Namespace Guide here.

As a concrete example:

 

# given a user who is a member of a team with the "team space configuration", with these values:
#     "root_namespace_id": "1990815600",
#     "home_namespace_id": "1990696960",

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Select-User: <MEMBER_ID>" \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"ns:1990696960\"}"

# ^ this one doesn't work, since you're trying to get the metadata for the current "root"

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "Dropbox-API-Select-User: <MEMBER_ID>" \
    --header 'Dropbox-API-Path-Root: {".tag": "root", "root": "1990815600"}' \
    --header "Content-Type: application/json" \
    --data "{\"path\": \"ns:1990696960\"}"

# ^ this one does work and returns the metadata for the member's folder under the team space root

 

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?