javascriptdropboxdropbox-apidropbox-sdk-js

Dropbox filesListFolder says my path is invalid


I'm using the Dropbox Javascript SDK to call dropbox.filesListFolder({ path: 'apps/my_app' }) and Dropbox returns the 400 error

Error in call to API function \"files/list_folder\": 
request body: path: 'apps/my_app' did not match pattern 
'(/(.|[\\r\\n])*)?|id:.*|(ns:[0-9]+(/.*)?)'

I've checked that my app has the correct permissions, generated a token on the API website to test with, and checked the folder exists in my account in the Dropbox app.

I've also tried the paths Apps/my_app, my_app.

Using backslashes like apps\my_app or apps\\my_app or apps\\\my_app doesn't work either.

What else can I try please?


Solution

  • Other than for the root itself (which would be just the empty string ""), Dropbox API paths should start with a "/". So for your example, you would supply "/apps/my_app".

    Also, note that if your app has the "app folder" access type, your paths will automatically be interpreted relative to the app folder itself, so you wouldn't include the "/apps/my_app" portion. That is, in that case to list the root of the app folder itself, you would just supply "", or to list some folder, for example named "subfoldername" inside the app folder, you would supply "/subfoldername".