Jump to content

URL request / Toodledo


grogers

Recommended Posts

I'm struggle to build an appropriately formatted URL request for a particular API (not really important which, but it's for Toodledo).

 

The API documentation says:

Tasks are edited by POSTing a URL encoded JSON encoded array to the API. Each element in the array will be a task object. You only need to set the fields that you want to set. For efficiency, you should try to send only the fields that have changed. At this time it is not possible to post XML data to Toodledo.

 

http://api.toodledo.com/2/tasks/edit.php?key=YourKey;

tasks=[{"id"%3A"1234"%2C"title"%3A"My Task"}%2C{"id"%3A"1235"%2C"title"%3A"Another Task"%2C"star"%3A"1"}];

fields=folder,star

 

I've tried about 100 different combinations of code like the following:

 

$arr = array ('id'=>$id,'completed'=>1,'reschedule'=>1);
$tasks = json_encode(array($arr));

$params = array('key'=> $this->key);
$params['tasks'] = $tasks ;
$params['fields'] = 'id,completed,reschedule' ;

$url="http://api.toodledo.com/2/tasks/edit.php?".http_build_query($params) ;

$response = file_get_contents($url);

 

None seems to get me to a URL formatted like they ask.  Can someone help me out?  I'm tired of banging my head against the table.

 

[Note... the fields I'm passing in single element of the $tasks array are different than in the example... but it's the format, not the content, that I can't get right]

 

Thanks in advance!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.