Getting all projects with their tasks in one call


Current I am using the official Asana PHP API to query all the projects that belong to one specific workspace. Then, for each project I query all the tasks. That works but takes a lot of time as there is one request per project to get the tasks.

First I call $client->projects->findByWorkspace that internally uses /workspaces/workspace-id/projects and then for each project

Then I call $client->tasks->findByProject($project->id); that internally uses /projects/project-id/tasks

I have been playing with expand, fields, opt_fields but I can’t get all the tasks included in the first call. I hope the API supports this.


I think this is not possible, but I have a doubt. Let me call our own Superman @Diakoptis to help :slight_smile:


It is possible with
POST /organization_exports

As long as you run it with service accounts.


Hey @Miguel_Febres,

I also think that is not doable with only one request.

Hi @Miguel_Febres,

Thanks for reaching out. As others have mentioned, it is not possible to get all tasks in a workplace in a single call. While it would be convenient, allowing such a potentially massive data request would cause stability issues for the API. If you do need to get all tasks in a workspace, you have the right approach: get all projects then iterate over each project to get all of the tasks in each project.

As @Vib_Wor mentioned, there is an alternative solution. Enterprise customers can request full org exports via the API.


1 Like

Thanks to all! I will stick with the current code.