Legend

Forum

Unread topics or posts

Topic

Unread posts

Locked

Announcement

Forums > Developers

Help formatting an edit.php request



AuthorMessage
Greg

Posted: Dec 09, 2010
Score: 0



I'm struggling to get a properly formatted URL to invoke edit.php.

I've tried about 100 different permutations of the code at the below. Nothing seems to nail the "URL encoded JSON encoded array" requested by the API documentation.

Thanks in advance!

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

$params = array('key'=> $this->key);
$params['tasks'] = $tasks ;

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

$response = file_get_contents($url);


This message was edited Dec 09, 2010.
Greg

Posted: Dec 09, 2010
Score: 0



Ok... I think there's more going on here that meets the eye... If I put this URL

http://api.toodledo.com/2/tasks/edit.php?key=99fd6cf9438bc73b42604261f73cc4ff;tasks=[{"id":158932683 ,"completed":1291926021,"reschedule":1}];fields=reschedule

in which I've INTENTIONALLY used an invalid task id, I get the following back:

[{"errorCode":7,"errorDesc":"Invalid task ID"}]

Perfectly reasonable. However, if I fix the task ID, here's what I get:

The website encountered an error while retrieving http://api.toodledo.com/2/tasks/edit.php?key=99fd6cf9438bc73b42604261f73cc4ff;tasks=[{%22id%22:15893 2683,%22completed%22:1291926021,%22reschedule%22:1}];fields=reschedule. It may be down for maintenance or configured incorrectly.

Any ideas? Obviously Toodledo is getting enough info to figure out the task ID. But something else is breaking...


This message was edited Dec 09, 2010.
Jake

Toodledo Admin
Posted: Dec 09, 2010
Score: 0



First, "reschedule" should not go in the "reschedule" field. You should put into the json block for each task that you want rescheduled.

Second, I think it may just be an encoding error. It doesn't look like you are encoding the : symbol as %3A and you might also try quoting integers, but this shouldn't be strictly necessary.
Greg

Posted: Dec 10, 2010
Score: 0



Can you explain what you mean by "put into the json block for each task you want rescheduled"? Maybe show where it fits below...

key=12345;tasks[{"id":123,"completed":123}]

Thank you!
Jake

Toodledo Admin
Posted: Dec 10, 2010
Score: 0



key=12345;tasks[{"id":123,"completed":123,"reschedule":1}]
You cannot reply yet


To participate in these forums, you must be signed in.



Toodledo Forums > Developers

Contact Us | Blog | API | Jobs | Press | Documentation | Forums Privacy | Terms | Copyright © 2004-2014