I am currently getting all tasks related to a given project, but, even though the documentation says I should receive the following elements when asking for Projects in opt_fields :
“name”: “Stuff to buy”
…all I get is gid and resource_type in the elements received from the API call…
Can anybody help me on this, since d like to avoid calling the API another time for projet data.
Thanks a lot !
what does your request look like?
Checkout the Input/Output Options and make sure you include “name” in your api call
You can also test here: Get a project
Thanks for your quick answer !
my request is as follows :
let response = UrlFetchApp.fetch(‘https://app.asana.com/api/1.0/tasks?project=123456&opt_fields=name,due_on,permalink_url,projects,custom_fields’
Shall I be more specific ?
My first suggestion to know which opt_fields are available, is NOT to look at the documentation
Instead, query one single task (/tasks/xxx), look at all the fields in the response, and use them when you query multiple tasks.
I think “projects” opt_field should work, but you can use memberships.project (without s) instead.
Sections are also in memberships.
You can add sub-fields, like
So, your query can look like this:
(using /projects/12345/tasks is the same as /tasks?project=xxx)
Thanks a lot !!
I can now get a project name with that kind of request :
The problem is that wuth such a request I only get one projet for a given task, whereas I know that some are associated to several projects…
Any idea how to solve that ?
Use this option that @Frederic_Malenfant mentioned:
(and of course you an add other fields that you might want as well)