Get all project tasks with their section


I am struggling with something rather basic. I need to get all the tasks for a project, and for each task I need the section it is in. In the documentation it says the information is inside memberships so I asked for this field in opt_fields which does provide the field, but it keeps coming as an empty array. Am I missing something?
The weirdest part is that I manage to get this information using some functions from the PHP library but not some others…

Thanks a lot
cc @Diakoptis the API big boss :stuck_out_tongue:


Haha. hey bastien.

Try this{projectID}/tasks?opt_fields=memberships.(project|section).name&opt_pretty

Check also Special operators


@Diakoptis you are definitely the best.

'opt_fields' => 'name,notes,due_on,completed,html_notes,',


Naaaaaah! :blush::blush::blush:

I would like to have the title of the column in the table view. How can I do that with opt_fields ?
And maybe it is with something else ?

Thanks !{projectID}/sections?opt_pretty

Do you need something like that? I am not sure that I understood the question.

1 Like

Yes thank you !
But I want the sections and the tasks together ? I have these 2 URLs but I want just one request:{projectID}/tasks?opt_fields=name,due_on,completed,assignee{projectID}/sections?opt_pretty

Do you have any idea ?


1 Like

Hey @Pauline,

you can use this{projectID}/tasks?opt_fields=name,due_on,completed,assignee,memberships.(section|project).name&opt_pretty

you will need to loop through the tasks, get the memberships, loop in the memberships for the to be equal to the of your request and get the section name. This just in the case that a task is multi-homed in more than one project.

If you are sure that the tasks are not multi-homed you can just use{projectID}/tasks?opt_fields=name,due_on,completed,assignee,

That makes sense?

1 Like

It is exactly what I wanted !

Thank you very much :slight_smile:

1 Like

Glad I helped :slight_smile:

That is awesome!