Hi!
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
2 Likes
@Diakoptis you are definitely the best.
'opt_fields' => 'name,notes,due_on,completed,html_notes,memberships.section.name',
5 Likes
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 !
https://app.asana.com/api/1.0/projects/{projectID}/sections?opt_pretty
Do you need something like that? I am not sure that I understood the question.
1 Like
Hey @Pauline,
you can use this https://app.asana.com/api/1.0/projects/{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 project.id to be equal to the project.id 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
https://app.asana.com/api/1.0/projects/{projectID}/tasks?opt_fields=name,due_on,completed,assignee,memberships.section.name&opt_pretty
That makes sense?
1 Like
It is exactly what I wanted !
Thank you very much
1 Like