Filtering tasks by user id and tag using API

Hi! I am using Asana’s API wrap - GitHub - Asana/php-asana: Official PHP client library for the Asana API v1.

I am trying to get tasks with specific tag assigned to a specific user. I am using the code below:

$tasks = $client->tasks->findAll(['tag' => 95366827789619, 'assignee' => ['id' => 291851918622743]]);
foreach($tasks as $task) {
    var_dump($task);
}

But I end up with all the tasks with this tag, filtering by user does not take place. Apparently I am not using ‘assignee’ parameter properly, but can’t figure out what exactly is wrong.

Thanks.

Ah, I think I know what’s going on.

Our API has asymmetry for reads vs. posting data - what comes back from a read can differ from what you supply to our API when you make requests like queries or setting data with POST or PUT requests (that is, writes to modify tasks with our API).

If you sort of squint at the fine print in our documentation, you can see that in the assignee field when querying tasks, the first example is just a number - you just send a number, not an object with an ID and the number.

Try this:

$tasks = $client->tasks->findAll(['tag' => 95366827789619, 'assignee' => 291851918622743]);