ForumsDeveloperscURL/Applescript can't get token
cURL/Applescript can't get token
Author | Message |
---|---|
beyondesign |
First of all, I'd like to compliment Toodledo for the fantastic app/service and the user community for being so helpful. It's all quite impressive really. I could go on, but I understand we're all busy.
Anyhow, I'm attempting to automate some things for my department using a command-line/Applescript hybrid and have gotten some things to work, but have failed at getting the API to generate a token. Here's what I've got thus far (output below): property user_id_string : "[my_user_id]" set local_cookie_path to POSIX path of ((path to documents folder as string) & "cookies.txt") do shell script "curl -c " & local_cookie_path & " -d 'email=[[email protected]]&pass=[my_password]' https://www.toodledo.com/signin.php" set token_string to do shell script "curl -b " & local_cookie_path & " http://api.toodledo.com/api.php?method=getToken;userid=" & user_id_string do shell script "rm " & local_cookie_path return token_string output: <?xml version="1.0" encoding="UTF-8"?><error>no userid specified</error> I have a feeling I'm not passing the cookie correctly as the command string clearly includes the user id. That said, I'm admittedly a cURL novice (graphic designer by trade) and would appreciate any help you might have to offer. BTW If I'm not mistaken, I read somewhere in the forum that someone had gotten cURL to work, though after extensive searching I have yet to find the thread that mentions how it's done. BTW2 I'm sure there are easier ways of accomplishing this, but I'm kind of stuck using these technologies as the final application must be shared with multiple users and there's little to no support for installing additional utilities/software. |
Jake Toodledo Founder |
Sorry, we are not familiar with AppleScript. Hopefully someone else here is.
|
beyondesign |
Thanks for the reply. After I posted, I ran the same commands through Terminal (without the Applescript, obviously) and got the same results. Sans AS:
curl -c /path/to/cookies.txt -d '[[email protected]]&pass=[my_password]' https://www.toodledo.com/signin.php curl -b /path/to/cookies.txt http://api.toodledo.com/api.php?method=getToken;userid=[my_user_id] The first command performs as expected (writes out the cookie with what appears to be the proper content), but the second gives me the same result as the AS-wrapped example. |
Warren |
Perhaps you are thinking of this post using wget on OSX instead of cURL. http://www.toodledo.com/forums/3/2227/0/back-up-your-toodledo-data-with-wget.html
Check that your curl has ssl support. The wget I started with did not and I had to install/compile a new one that did. |
You cannot reply yet
U Back to topic home
R Post a reply
To participate in these forums, you must be signed in.