Without any doubt, Wunderlist is the most popular to do list manager. With its increasing popularity, demand is growing for people to let Wunderlist expose its API to public so that users can build great apps around it and integrate it with their systems. Posts such as this on Wunderlist support forum clearly indicate the popularity and demand for such an API.
Although, Wunderlist has yet not exposed any public API but it seems there are definite plans for that going by post such as this Nevertheless, what I found is that it is easy to discover the Wunderlist API by simply inspecting the HTTPS traffic over the Wunderlist web site. If we see their Licenses section, it is easy to see that they use backbone.js along with Jquery and RequireJs giving the clear indication of MVC pattern being in use along with JSON as the data exchange format
Now, lets head over to the browser to inspect the HTTPS traffic and see if we can get some information about their API. What I am going to do is login to Wunderlist website with my credentials and record the
HTTPS traffic in the Chrome inspector. I have also turned on the button for
Preserve log upon Navigation
If we filter by requests of type XML HTTP Request(XHR), we will see a
/login to the host
api.wunderlist.com. In the request payload, I also see my username and password in cleartext. Although
I do not have anything to worry since this is transmitted over SSL
If we just scroll few lines down, I see another request
api.wunderlist.com with this JSON payload and the response is a considerable JSON response. I could the names of lists and tasks in the JSON response.
Great, it seems that we have just discovered a bunch of REST API calls. These are batched together in single HTTP request for optimization. We also know the method
POST of these requests and also the parameters some of them. The next step is to take this request individually and test it one by one. But how do we do it?
For this purpose, I am using an excellent Chrome extension called Dev HTTP Client
First, lets authenticate ourselves using the
/login API. This will be a post request containing the
password for the Wunderlist.
The result is the following JSON response:
This piece of information is very important for us in JSON response:
token:8758a4a0f983177a427a879a30b144d92bc2f01e. This is the token which we need to send in
any of the other REST API requests otherwise you will get this error in response:
Let’s try to retrieve the lists using the
/lists API and the token:
The result is the list of Wunderlist lists I have in my account:
Using a similar approach, we can invoke the following REST API’s and get their responses in JSON:
A note about authentication
At this moment, there is no OAuth implementation for the authorization on this API and probably this is the reason the API is not public yet.
This means, the token we recieve in response
/login call will have some expiry date attached to it. Hence, if we plan to build some functionality based on this information,
it is sufficient to assume that we need to re-authenticate using the
password once the token expires.
In the part II of this blog post, I am going to share a partial implementation of this API in java using Retrofit