Clone this wiki locally
I’m a toodledo user and I just wanted to use that for some of my stuff, I basically program in Java, and seems like the toodledo guys haven’t got an official Java api, so I made one.
Pretty basic and pretty straightforward.
There’s an interface with some “handy” methods, they should be enough for any basic usage of toodledo:
and it has its implementation file in the same package:
org.loststone.toodledo.ToodledoApiImpl it’s also a good example of how to use the other methods in the library. Also, there’s the javadoc in the doc/javadoc directory (
If anyone needs anything that’s not in the interface feel free to code it and add it to the library. Basically what all the methods do is create a
Request, which inherits from the
org.loststone.toodledo.request.Request class and then return a class than inherits from
org.loststone.toodledo.response.Response, like this we encapsulate all the HTTP stuff, and the Response inherited class contains a
getResponseContent that gives back the info from the call. If the response is easy you can parse the output there, but if the response is something bigger, like one of those xmls then you can use one class at the package org.loststone.toodledo.xml to parse it. Up to you.
Then, more advanced stuff:
As this is a library, every program that uses it should be able to deal with more than one user concurrently. So, if you use the initialize method in the interface you’ll get a AuthToken, this is an object which contains a key that will be valid for 4 hours, so, for every user you must cache or serialize or whatever that object. If you try to authenticate several times the same user (use the initialize method for the same user) that user will be banned temporarily from using the API, and that’s not good. So, use that call or get an AuthToken manually and save that key for future use.
The initialize method needs the userid, not the username, you can get the userid from the toodledo webpage, it’s always a 15 or 16 hexadecimal string. If for any reason you cannot log into the webpage and get the userid for a user you can user the getUserId method in the API. This method only requires the user e-mail and password. Take care using this method as it’s sending the password in plain text format over the net as an http parameter. So, use it only if necessary.
No problem here, the API is very straightforward and easy to use, if you’ve got any doubt you can check the toodledo API documentation here.
There is a very simple example program to have an idea of how everything works, you can find it under the package
Using the components as standalone
Every method of the Toodledo REST API have a REQUEST and a RESPONSE method. Some of them a litte cumbersome as they involve some xml parsing and bla bla, but other than that they’re very easy.
All the requests use the commons-http package to do HTTP GET’s to the REST API.
You can contact me at:
e-mail / jabber: email@example.com
irc (freenode): mdepalol