You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

MBUST's avatar
MBUST
Explorer | Level 3
3 years ago

When trying to list folder contents, error happens

Hello,

 

New to Dropbox API. 

 

I can create folders and files, but when I try to list the contents of a folder, I get an error message. I'm particularly interested in getting the contents of the root folder, but for now, I'm just trying to test it with a specific folder I have.  I'm using https://api.dropboxapi.com/2/files/list_folder, and trying to copy the documentation example exactly, like so:

--header "Authorization: Basic XXXX"

--header "Content-Type: application/json"

--data "{\"include_deleted\":false,\"include_has_explicit_shared_members\":false,\"include_media_info\":false,\"include_mounted_folders\":true,\"include_non_downloadable_files\":true,\"path\":\"/FolderTest\",\"recursive\":false}"

 

But I get this error, and I don't see the mistake I'm making:

{
"error" : 
{
".tag" : "path",
"path" : 
{
".tag" : "unsupported_content_type"
}
},
"error_summary" : "path/unsupported_content_type/.."
}
 
Any ideas? Thanks.
  • I see you're supplying a folder path and not a shared link and are using app authentication on this /2/files/list_folder call, which can cause this 'path/unsupported_content_type' error.
     
    When using app authentication, that is, with the app key and secret instead of an access token, you do not have access to an account directly. Using app authentication with /2/files/list_folder is instead meant for accessing the contents of a shared link.
     
    So, you would need to either supply a shared_link on the /2/files/list_folder call, or switch to using user authentication, that is, with an access token for an account.

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

    I see you're supplying a folder path and not a shared link and are using app authentication on this /2/files/list_folder call, which can cause this 'path/unsupported_content_type' error.
     
    When using app authentication, that is, with the app key and secret instead of an access token, you do not have access to an account directly. Using app authentication with /2/files/list_folder is instead meant for accessing the contents of a shared link.
     
    So, you would need to either supply a shared_link on the /2/files/list_folder call, or switch to using user authentication, that is, with an access token for an account.

    • MBUST's avatar
      MBUST
      Explorer | Level 3

      Hello Greg!

       

      Thanks for your help!!

       

      I thought I had to use the type of authentication use in the documentation's example (as I recall reading somewhere else here), but I see now that using the token will do what I need. Thanks!

    • rohitkmk's avatar
      rohitkmk
      Explorer | Level 4

      Hi Dropbox Team,

      When I try to use API: /2/files/list_folder using App Authentication using my personal account it works successfully, but when I try same using my Company/Business account it gives following error:

      {
          "error_summary""path/unsupported_content_type/..",
          "error": {
              ".tag""path",
              "path": {
                  ".tag""unsupported_content_type"
              }
          }
      }


      Could you please let us know why this difference is there?

      Also Dropbox documentation mentions we can use App Authentication as well, so why it is been restricted ?

       

       

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        Hi rohitkmk,

        As Greg already mentioned, app authentication can be used for information that doesn't need access to particular account (either personal or business) - listing public accessible shared links or at most password protected (the one you can provide thorough the call parameter). App Authentication identifies the application itself, but not the user that uses it! That's why you cannot use App Authentication to access data closely related to any particular account (i.e. to user, again both neither personal nor business) in any way (here we assume no any shared link points to the content; a link that can be "workaround"). To list (or do something else to) any part of account content, you need to represent somehow user having access to that content. That's what different tokens (access token and refresh token) are used for - user authentication.

        According to your description you are already using user authentication (most probably; and by mistake label it as app authentication). If so, just keep in mind that for individual accounts providing token identifies in unique way particular user (the only user), but in case of business account (team account) it identifies in unique way the team (not user) if you have selected one team scope at least. You can solve it by removing all team specific scopes from permissions of your application (if you don't need them) or explicitly point the user using 'Dropbox-API-Select-User' header - whatever better match your case.

        Hope this helps.

         

        PS: Just a recall - when you change permissions, you need to reauthenticate the user; such changes are NOT retroactive!

        In any case post exact way you got to the error (like represented in OP).

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 4 days ago
333 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!