This project is read-only.

Sample Code using the Rtm class

Here's a code sample that shows how to use the Rtm class ("layer 2", or "high level" of the IronCow API).

Rtm rtm = new Rtm("your api key", "your shared secret");
rtm.AuthToken = GetAuthenticationToken(); //TODO: get an authentication token

// Have fun!
foreach (TaskList list in rtm.TaskLists)
    foreach (Task task in list.Tasks)
        Console.WriteLine("   - {0}", task.Name);

To get an authentication token, check the authentication documentation on Remember The Milk's website. The Rtm.CheckToken(), Rtm.GetAuthenticationUrl(), Rtm.GetFrob() and Rtm.GetToken() will help you get through the several steps needed for this. But basically, it goes something like this:

IronCow.Rtm rtm = new IronCow.Rtm(ApiKey, SharedSecret);
string frob = rtm.GetFrob();
System.Diagnostics.Process.Start(rtm.GetAuthenticationUrl(frob, IronCow.AuthenticationPermissions.Write));   // Run the default browser to open the "authenticate" page on RTM's website.
Console.WriteLine("Press enter to continue after you have authenticated in the browser...");
rtm.AuthToken = rtm.GetToken(frob);    // Get the auth-token with the same frob we got earlier.
Console.WriteLine("Successfully authenticated! Got token: " + rtm.AuthToken);

The TaskList and Task objects, along with the other ones you'll get through the Rtm class, are always in sync with the server. If you set their name property, or add or remove elements to them, the appropriate requests are sent behind the scenes.

Last edited Sep 3, 2010 at 12:14 AM by ludovic_chabant, version 3


No comments yet.