cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

v2 API

v2 API

Klaus A.
Helpful | Level 5
Go to solution

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."

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

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.
Helpful | Level 5
Go to solution
Thanks 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-DB
Dropbox Staff
Go to solution

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.

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Klaus A. Helpful | Level 5
What do Dropbox user levels mean?