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: 

When trying to list folder contents, error happens

When trying to list folder contents, error happens

MBUST
Explorer | Level 3
Go to solution

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.
1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

12 Replies 12

Greg-DB
Dropbox Staff
Go to solution

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
Explorer | Level 3
Go to solution

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
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 ?

rohitkmk_0-1699694475045.png

 

 

Здравко
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).

Greg-DB
Dropbox Staff

@rohitkmk I see Здравко already helpfully offered some guidance here, but if you're still having trouble with this, please feel free to share the relevant code/request that's failing with this error. Please be sure to redact any secret values, such as an app secret or access token though.

rohitkmk
Explorer | Level 4

Hi @Greg,

Please find the details of issue I am facing with /2/files/list_folder API.
When I try to fetch the list of folders using this API, I only the list of folders I have created for my Apps (Apps created from Developer console). For e.g.:

rohitkmk_0-1699935395042.png

But other folders to which I have access in Dropbox (created by other team members or myself), they never appear in the List folder API response.

rohitkmk_2-1699936124409.png


Should I ask my Team admin to create App in Developer console, use the client id and client secret(for Bearer token generation) of this App to call APIs

so that I can get list of all folders and files created by the Team or do I need to have Administrator role for myself to fetch all these details?
Could you please guide?

rohitkmk_3-1699936549744.png

 

Здравко
Legendary | Level 20

Yes @rohitkmk, by default your user folder could be accessed only. Did you set 'Dropbox-API-Path-Root' header to change this? (your headers stay invisible on the screenshot) If not, try it. 😉

Good luck.

rohitkmk
Explorer | Level 4

Hi Здравко, I am using automated connector in a 3rd Party Application which uses these APIs . I cannot add Dropbox-API-Path-Root in request header in the actual connector, so I wanted to check if we use App created by Admin to call this API, would I get to see all folders present in the workspace using list folder API call. Could you please help?

rohitkmk
Explorer | Level 4

Hi Здравко, 
I am using a 3rd Party Connector which uses this Dropbox APIs. I cannot add Dropbox-API-Path-Root in actual connector. So wanted to check if using App(to generate Bearer Token) created by Administrator work and help in getting list of all folders in workspace?

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    rohitkmk Explorer | Level 4
What do Dropbox user levels mean?