Start using Wunderlist SDK

2019-07-10 22:02发布

I am using Wunderlist SDK for a sample app that im developing for academic purposes.

From the Wunderlist's docs i have the following code working:

$(document).ready(function(){
   var WunderlistSDK = window.wunderlist.sdk;
   WunderlistAPI = new WunderlistSDK({
      'accessToken': access_token,
      'clientID': client_id
   });

   WunderlistAPI.initialized.done(function () {
       WunderlistAPI.http.lists.all().done(handleListData).fail(handleError);
   });

   function handleListData(data){
       $("#tasks").append("<button onclick='lookup_tasks(" + data.id + ")'>Search tasks for this list</button>");
   }

   function handleError(error,event){
      alert("Error: "+ JSON.stringify(error));
   }
});

I am confused on using the the rest of the API because i cant figure out how can i perform other requests using the REST API

For instance if i want to search all tasks by a list_id i am trying the following but it wont work:

function lookup_tasks(list_id){
    $.get("http://a.wunderlist.com/api/v1/tasks",{list_id: list_id},function(data){
        alert(JSON.stringify(data));
    }); //Neither works passing the client_id and access_token as params
}

Anyone knows what am i misunderstanding?

0条回答
登录 后发表回答