Get all tasks completed 20 minutes ago

How do I retrieve all tasks from a project that were completed 20 minutes ago?
Code below shows me all tasks or do not shows any:

$date = new DateTime();
$date->modify(‘-20 minutes’);
$modifiedSince = $date->format(‘Y-m-d\TH:i:s.u\Z’);

$params = [
‘project’ => $project_gid,
‘completed_since’ => $modifiedSince

// Отправляем запрос
$tasks = $asanaClient->tasks->getTasks($params);

Hi @Геннадий_Шершов,

A couple of things to note:

I think you’re using the PHP client? (Fair warning, I don’t know PHP.)

  • I think your getTasks method is calling the “get tasks form a project” API endpoint. That endpoint doesn’t have any capability to filter by a task property like the completed time.

  • The API endpoint you would want for that type of filtering is the Search API. I took a quick look at the PHP client and it looks like that would be the searchTasksForWorkspace method.

  • The parameter you would want to use for filtering in that endpoint is completed_at.after, not completed_since. A full list of the avaialble parameters is in the API docs for the Search API.

Yes, that’s correct. I use PHP and the Asana-php client. The “searchTasksForWorkspace” method is available only for premium accounts, and unfortunately, I can’t use it. Is there really not a single method in the entire API to simply extract tasks from one project that were completed, let’s say, in the last hour?

That method is the Search API. As you say, though, it’s not available for free user plans.

I have a paid account. My account is part of the company’s corporate account group. So, I’m asking if there’s another solution to find a method that allows retrieving tasks from a project with a specific input filter, instead of downloading thousands of project tasks and then filtering them using PHP.

Now I’m confused; I thought you were saying you couldn’t use it because you don’t have a Premium account. If you have a paid account, then you can use the search API which gets you what you want. Note that in addition to the “completed” filter, you can also include other filters such as restricting the search to just one project.