Search code examples
javascriptjquerydropboxdropbox-api

using Dropbox on my homepage


I am building a Dropbox API JavaScript App. At the moment, users can login with their Dropbox Account, which is done by a jQuery Library that also creates a Folder in the users Dropbox which can be used by the App. Now I want the user to manage the files of this dropbox folder on my homepage. The best way, in my opinion, was to make an iframe, but that does not work with Dropbox. Now I am struggling with the Dropbox Datastore API, but I don't get functions to work.

Dropbox.Client.prototype.readdir("test", {removed:false},
function(a,b,c,d){
  alert("hello");
});

This, for example, returns the Error "this.urls is undefined".

Dropbox Documentation

I guess I am doing something fundamental wrong, but I couldn't find any tutorial on this.

Thanks for helping.


Solution

  • It looks like you're calling readdir directly from a class's prototype instead of an instance of that class. You may want to read up on object-oriented programming in JavaScript.

    Presumably somewhere, since you're logging in a user, you have a Dropbox.Client object, and you should be calling methods on that object. E.g.

    var client = new Dropbox.Client({ key: '...' });
    // ...
    client.readdir("test", { removed: false }, function (err, ...) { ... });