ForumsSearch



Search results for "Posted by Andy Geers"
Author Message
Andy Geers

Posted Oct 13, 2008 in: Mozilla Ubiquity
Score: 1
Here's a really quick hacked together script that lets you add tasks. You'll need to substitute your userId into the "myuserid" variable, and an MD5 hash of your password into the "hashed_password" variable (use a tool like http://www.adamek.biz/md5-generator.php to create that). You also need to paste in an implementation of MD5 from here: http://www.semnanweb.com/jquery-plugin/download/jquery.md5.js.txt
---
var baseUrl = "http://www.toodledo.com/api.php";
var token = null;
var api_key = null;
var hashed_password = "MYPASSWORDMD5ED";
var myuserid = 'MYUSERID';

var getToken = function(callback) {
var params = {method: 'getToken', userid: myuserid};
jQuery.get( baseUrl, params, function( response ) {
token = jQuery(response).find("token").text();

api_key = jQuery.md5( hashed_password + token + myuserid );
callback(api_key);
})
}

CmdUtils.CreateCommand({
name: "add-task",
takes: {"task description": noun_arb_text},
preview: "Adds a task to Toodledo.",
execute: function( description ) {
var addTask = function(api_key) {
var params = {
method: 'addTask',
key: api_key,
title: description.text
}
jQuery.get( baseUrl, params, function( response ) {
var error = jQuery(response).find("error").text();
if (error && error.length) {
displayMessage("An error occurred: " + error);
} else {
displayMessage("Task added!");
}
})
}

if (api_key == null) {
getToken(addTask);
} else {
addTask(api_key);
}
}
})
Andy Geers

Posted Oct 13, 2008 in: API and OpenID
Score: 0
Actually, never mind, it's working now. Thanks for the speedy response - you guys rock!
Andy Geers

Posted Oct 13, 2008 in: API and OpenID
Score: 0
Ah, I see!

Hmm.. I'm getting "key does not validate" errors - does it take time after you set a password for it all to start working?
Andy Geers

Posted Oct 13, 2008 in: API and OpenID
Score: 0
Hi there,

How does the API interact with OpenID? You need to use your password as part of the API key, and yet surely Toodledo doesn't actually know my password if I log in using OpenID?

Andy