Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here!
Forum Discussion
Klaus A.
9 years agoHelpful | Level 5
v2 API
I have an app that used to run fine on the v1 API using xmlhttp requests. Migrating the app to v2 I can't get anything except authorization to work. The app has read/write access to its own folder only.
For example: I want to get a list of the files/folders in a folder named "Recipes" in my app folder:
I create an xmlhttp request (Browser based javascript) with
method: "POST",
url: "https://api.dropbox.com/2/files/get_metadata",
Request header: "Content-Type: "application/json",
and the posted data body is a javascript string:
{"path":"/Recipes"}
I always get a 409 error with "/path/not found" even though I can see the folder clearly in my Dropbox app.
If I try to get the file/folder list of my app's folder I get a 400 error with the message "the root folder is not supported."
You mentioned your app has an app folder, so can you double check that the app folder itself contains a "Recipes" folder in it? I.e., when you look at dropbox.com, that would be at /Apps/<app folder name/Recipes. Also, if you've registered multiple apps or used multiple accounts, make sure you're using an access token for the right app and account.
In any case, to list the contents of a folder, including root (which is the app folder for apps with the app folder permission) you should use the /2/files/list_folder and /2/files/list_folder/continue methods.
3 Replies
- Greg-DB9 years ago
Dropbox Community Moderator
You mentioned your app has an app folder, so can you double check that the app folder itself contains a "Recipes" folder in it? I.e., when you look at dropbox.com, that would be at /Apps/<app folder name/Recipes. Also, if you've registered multiple apps or used multiple accounts, make sure you're using an access token for the right app and account.
In any case, to list the contents of a folder, including root (which is the app folder for apps with the app folder permission) you should use the /2/files/list_folder and /2/files/list_folder/continue methods.
- Klaus A.9 years agoHelpful | Level 5Thanks Greg K.
Yes, I am using the correct access token and the /Apps/<app folder> has a folder named Recipes in it. I will try to use the list_folder interface. But I still don't understand why the "get_metadata" does not work. It was fine under the v1 interface. - Greg-DB9 years ago
Dropbox Community Moderator
Thanks! I can't seem to reproduce that issue though. This works correctly for me:
$.ajax({ url: 'https://api.dropboxapi.com/2/files/get_metadata', type: 'POST', processData: false, data: JSON.stringify({"path": "/Recipes"}), contentType: 'application/json', headers: { "Authorization": "Bearer <APP FOLDER ACCESS TOKEN>" }, success: function(data) { console.log(data); }, error: function(data) { console.error(data); } Object {.tag: "folder", name: "Recipes", path_lower: "/recipes", path_display: "/Recipes", id: "id:JmcDh3CS6tAAAAAAAAABCg"}
Please feel free to open an API ticket showing the account and app folder with the Recipes folder, and the API call request/response with the unexpected result and we'll be happy to look into it specifically for you.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,037 PostsLatest Activity: 20 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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!