GET tasks is not returning the usual fields

When calling https://app.asana.com/api/1.0/tasks/{task}?opt_fields=dependencies
From the docs I expect to see all the usual fields and the extra field ‘dependencies’ but i only get the dependencies.

That’s expected behaviour. As soon as you give opt_fields, it only shows what you asked. The doc says otherwise?

To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.

The wording makes it seem that it will append to the solution

And also if i opt in to memberships the object is returned as empty but if i don’t send an opt_fields param it will return memberships with data

The wording might be a bit confusing indeed. There is another concept called opt_expand, and I believe for objects like memberships it might be necessary. But things might have changed recently, @Phil_Seeman rings a bell?

If you ask for memberships.section for example it works.

opt_expand is technically still available but has been deprecated and Asana doesn’t recommend its use. The recommended solution for sub-objects like memberships is the one @Bastien_Siebman illustrated; that is, use opt_fields and ask for specific fields of the sub-object, such as

opt_fields=memberships.project, memberships.section

or

opt_fields=memberships.project.name, memberships.section.name

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.