We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

dochdl's avatar
dochdl
Helpful | Level 6
7 years ago

Getting files from a non root namespace

Hi
I want to be able to track all changes in all folders
including in namespaces that are not a root user's root folder
I use a team token. 

When I use /list_folder with the Dropbox-API-Select-User header, and path="" and recursive=true
I only get the root folder for that user
I also tried this with the Dropbox-API-Select-Admin header but I got the admin's root folder

And /namespaces/list only gets the namespaces but without the folders\files inside.
What is the api I need to use?
I also want to move to push notifications, will I get push notifications on folders inside such a namespace?

And another thing, why a user's root folder in UI and in log_events apprears as the user's name and in the list if namespaces it appears as "root"?

Thanks you

  • So seems as if using Dropbox-Api-Select-Admin header solves the problem
    However, it does not appear in your documentation

    so the answer is using this request:
    POST /2/files/list_folder
    Host: https://api.dropboxapi.com
    Authorization: Bearer <token>
    Content-Type: application/json
    Dropbox-Api-Select-Admin: dbmid:AAA...Rw

    {
    "path": "ns:2464786048",
    "recursive": true
    }

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    If you have a Dropbox Business API app with the "team member file access" permission, using /2/files/list_folder with the Dropbox-API-Select-User header and path="" and recursive=true is the right way to list the all of the contents of a user's account.

     

    You can also specify a namespace in the path value instead. Check out the Namespace Guide for information on doing that.

     

    Make sure you check the `has_more` value in the result returned by /2/files/list_folder though. If it's true, you need to call back to /2/files/list_folder/continue to get more entries.

     

    If you want, you can register for webhooks to get notified of changes automatically. Be sure to check out the webhooks documentation for Business apps in particular too.

     

    I'm not sure I understand your last question though. Can you clarify?

    • dochdl's avatar
      dochdl
      Helpful | Level 6

      Hi
      Thanks for the answer but it doesn't work
      I got the namespace id from namespaces/list
      Then I used list_files with path=ns:<namespace_id> and I fot path not found

      The question about webhooks was how will I get the notification on a change in a shared\team folder. Will I get all the ids of all users in the notification? If so, is it a must? in that case I would prefer to poll changes in those folders. 

      Regarding the different path issue:
      for ex: 
      let's say user1 adds 1 file to it's root folder and calls it file1
      When I ask for list_folders with path="" for user1 the path I will get for it will be '/file1'
      but the log event for the creation of the file will give me a different path '/user1/file1'
      why is that?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        For the issue listing the namespace by namespace ID, please share some sample code and full output so I can take a look.

         

        Yes, if you register a Dropbox Business API app for team member file access notifications, you will get notified for changes to any member account. From the documentation:

         

        "Note that a single change to a file in a shared folder will trigger a webhook for each user that the folder is shared with (and will also show up in the /list_folder entries for each account)."

         

        Finally, the matter of the different paths sounds like a result of the new team space and member folders configuration. When you're using /2/files/list_folder[/continue] for a specific user, the paths are already relative to that member's folder. When you're using the audit log, on the other hand, the paths are relative to the team space itself, so it will contain the member folder name.