英文:
Dropbox filesListFolder says my path is invalid
问题
我正在使用Dropbox的Javascript SDK调用`dropbox.filesListFolder({ path: 'apps/my_app' })`,但Dropbox返回400错误
```js
在调用API函数“files/list_folder”时出错:
请求主体:路径:'apps/my_app'与模式不匹配
'(/(.|[\r\n])*)?|id:.*|(ns:[0-9]+(/.*)?)'
我已检查我的应用程序具有正确的权限,在API网站上生成了一个用于测试的令牌,并在Dropbox应用程序中检查了我的帐户中是否存在该文件夹。
我还尝试了路径Apps/my_app和my_app。
使用反斜杠如apps\my_app或apps\\my_app或apps\\\my_app也不起作用。
请问还有什么其他方法可以尝试?
<details>
<summary>英文:</summary>
I'm using the Dropbox Javascript SDK to call `dropbox.filesListFolder({ path: 'apps/my_app' })` and Dropbox returns the 400 error
```js
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?
答案1
得分: 1
除了根目录本身(即空字符串""),Dropbox API 路径应以斜杠"/"开头。因此,对于你的示例,你应该提供"/apps/my_app"。
另外,请注意,如果你的应用程序具有“应用文件夹”访问类型,那么你的路径将自动相对于应用文件夹本身进行解释,因此你不需要包括"/apps/my_app"部分。也就是说,在这种情况下,要列出应用文件夹本身的根目录,你只需提供"",或者要列出应用文件夹内名为“subfoldername”的某个文件夹,你应该提供"/subfoldername"。
英文:
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".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论