PHP API - GetTasks returning no results - but no error

I am not getting an error but my response has zero results when using getTasks but I can get the task out of the project list if I use getTask().

I am using:
$tasks = $this->client->tasks->getTasksForProject(’’);


$tasks = $this->client->tasks->getTasks([‘project’ => ‘’], [‘limit’ => 20]);

Here are the response I am getting (count: 0):


I have one test task in my project but it isn’t returning any results. I have tried PHP API version 10.0.0, 10.0.2 and the lastest. Still the same results. Is this because the account I am using is still using the trial?


I don’t know PHP well enough but nothing is shocking on the image…

Thanks for the reply. It just always returns a response with a count of zero no matter what I try and I know there are tasks in the project. Oh well, I will keep messing with it. Do I need to upgrade to premium to get this to work? I am planning on it anyway when the trial runs out.

@Phil_Seeman any idea?

No, afraid I don’t know PHP, either, so can’t offer any advice here.

No, I’m sure that’s not the issue.

Hey guys,

I’m running into the same exact error; querying the API through PHP returns the same output as above, but querying via URL works as expected. Are there any updates to this?

It does actual work. I was just trying to inspect the returned response to figure out how to get the info I wanted. Docs aren’t too helpful on this. All you have to do is loop through the response and each iteration is a task object. For example:

$project_id = 'stringofprojectid'
$tasks = $this->client->tasks->getTasksForProject($project_id, [], ['limit' => 20])

foreach($tasks as $t) {
  // Get Name.
  // Due Date.
  $gid = $t->due_on

  // Loop through custom fields.
  foreach ($t->custom_fields as $k => $value) {
    // Find custom field by id.
    if ($value->gid == 'customfieldid') {
      // Get display value.
      $dis = $value->display_value;
1 Like

Lifesaver! I’m not sure why the API was returning a count of 0, but you’ve sorted it. Thanks!

1 Like