ForumsDevelopersGetting too many deleted tasks (PHP)


Getting too many deleted tasks (PHP)
Author Message
jensbn

Posted: Mar 07, 2016
Score: 0 Reference
Dear support,

I'm trying to get my application to get deleted tasks from Toodledo (other functionality works). Whenever I do so it gives me every deleted tasks in the past two or so months, regardless of me only requesting tasks more recently deleted. Did I make an error in my code somewhere or is this a problem with Toodledo?

//the relevant part of my code is this
$lastsync=1457099741; //timestamp for a few days ago
if ($data[lastdelete_task] > $lastsync){

$data = $toodledo->getResource("http://api.toodledo.com/3/tasks/deleted.php?access_token=$access_token&after =$lastsync",$access_token);

Regards,

Jens Nielsen
Jake

Toodledo Founder
Posted: Mar 07, 2016
Score: 0 Reference
It looks like you have a space in the URL. It should be "&after=$lastsync" instead of "after =$lastsync"
jensbn

Posted: Mar 11, 2016
Score: 0 Reference
Indeed there was a space. Probably the space turned up in a pasting error, I don't see it in my own code. My current string is pasted below, but still gives deleted tasks with timestamps older than $since. Any other ideas?

$data = $toodledo->getResource("http://api.toodledo.com/3/tasks/deleted.php?access_token=$access_token&after =$since",$access_token);
Jake

Toodledo Founder
Posted: Mar 11, 2016
Score: 0 Reference
Ok, I think I know the problem now.

First, you should use https. But thats not the issue. I believe you are using the sample code from our github account to do the getResource() call. This was made for the demo and only supports simple queries. If you look inside that function and log the $url that is being sent to our API you'll probably see the mistake. There are probably two question marks in the URL. It should be simple to alter this so it works. If you want a dirty way to get it working try this:

$data = $toodledo->getResource("http://api.toodledo.com/3/tasks/deleted.php",$access_token."&after=$since");


This message was edited Mar 11, 2016.
You cannot reply yet

U Back to topic home

R Post a reply

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