Introducing GroovyRTM: A Groovier way to Remember The Milk
I have always wanted to give something back to the wonderful creators of the Remember The Milk to-do list service. It has been a great tool for me the past couple years by helping me keep organized. Thank you, RTM crew!
Over the last couple months I’ve been taking a bit of spare time to write something that I hope all of us can benefit from: GroovyRTM
What is GroovyRTM?
GroovyRTM allows you to easily take advantage of the Remember The Milk REST API using any language on the JVM. In short, you can now write apps for Remember The Milk without having to worry about all the HTTP transaction stuff, error handling, etc. As its name implies, it’s written in Groovy, which made it much easier to write and test. 
How can I use it?
To get started, you’ll need 3 things:
- Download groovyrtm-all.jar from the project on GitHub
- Request an API key (you’ll probably want an RTM account to test it with, too)
- Create a RtmService.properties file as explained in the project Wiki
UPDATE: I’ve created a quick-start project that has everything you need to get started quickly! I included an application authorization example because that’s the first hurdle. Download it here
Just how easy is it? Suppose you want to write a little Java app that adds a new task:
import org.eriwen.rtm.*;
class MyGroovyRtmTest {
public static void main(String[] args) {
GroovyRtm rtm = new GroovyRtm("api-key", "shared-secret");
rtm.testEcho();
}
}
It’s that easy! Now, it’s a little deceiving because the first time your app runs you have to allow it access via the RTM website. The best part is… it’s open source! You can check out the source with Git:
git clone git://github.com/emwendelin/groovyrtm.git
Awesome! Can I help?
Of course! Get the code, give me suggestions, use it and tell me what you think. I am willing to add people to the project that show me their interest and some good Groovy code. Just hit up the issue tracker or use my contact form for questions or suggestions.
If you think it’s cool but you can’t use it, help me get it out there by digging it or voting on your favorite aggregator.
Here’s my (groovy_home)/lib/RtmService.properties file:
api.auth.url.base=”http://www.rememberthemilk.com/services/auth/”
api.url.base=”http://api.rememberthemilk.com/services/rest/”
api.encoding=”UTF-8″
api.key=”my-key”
api.perms=”delete”
api.sharedsecret=”my-secret”
api.delay=1000
logging.level=DEBUG
-Kodeninja
You’re properties file isn’t in the correct location. By default, I look for the config file in $GROOVYRTM_DIR/config/RtmService.properites. If I don’t find it there, I look in $GROOVYRTM_DIR/
What might make things easier for you is instantiating RtmService like so:
RtmService groovyrtm = new RtmService(‘your-api-key’,’shared-secret’)
groovyrtm.testEcho()
You don’t even need a config then. Check out the groovydocs at http://eriwen.com/groovyrtm/javadoc/ to see what’s available :)
Hi Eric,
What should be the groovyRTM directory? I have the groovyrtm.jar in the (groovy_home)/lib/ directory. Isn’t this where the RtmService.properties file is supposed to be?
Also, I tried the approach you suggested. It works and testEcho() returns “true”. But after that when I call tasksAdd(), it again throws the same exception – org.eriwen.rtm.RtmServiceException: Error: Application is not authenticated!
What am I missing now?
-Kodeninja
To add tasks you have to authenticate your application. I have an example of how to do this in the sample project at http://kenai.com/projects/groovyrtm/downloads/download/GroovyRtmAuth.zip but I just copied the code to the project wiki at http://kenai.com/projects/groovyrtm/pages/Home for your convenience.
Just to add to the previous post, when I call testLogin() after a successful call to testEcho() , it throws the following exception:
org.eriwen.rtm.RtmServiceException: Login failed / Invalid auth token
-Kodeninja
testLogin() unfortunately requires an authenticated app as well.
If you don’t mind using NetBeans my sample project will get you up and running in no time :)
Also, feel free to email me or hit up the project forums at http://kenai.com/projects/groovyrtm/forums/forum
Eric,
Have you taken a look at iBeans? It’s right up the same alley as GroovyRTM. a RTM iBean would be simple to create to accomplish the same goals (for webapp use). Would love your feedback on the usefulness of iBeans for solving this type of problem.
http://www.mulesoft.org/display/IBEANS/Home
Ken
PS if you create a RTM iBean and submit it, let me know and I’ll make sure you are sent an cool iBeans fleece.
Interesting. I had not looked at iBeans before.
If I could come up with a clever webapp that integrated RTM and something else… like a wiki… it might be a very useful project.
Thanks, Ken!
Check out http://blogs.mulesoft.org/twitter-your-blog-with-ibeans/ for some ideas of how you can use iBeans to create these types of apps.
BTW, thanks for turning me on to RTM. I’m going to have to start using it now!