I have been trying to get the custom field values for example Priority, Membership. But I am unsure of what to put on the API endpoint. I have got the images to show what I have tried so far.
This is the fields on my Asana project. The first row has value for Priority and Membership. I have got fields: Assignee, Due date, Priority, Membership
I am sending the API Request with the query parameters you can see in the image. The opt_fields are : name,due_on,completed,assignee,priorities,Membership
But I am only getting values of Fields and not getting values for custom fields Priority and Membership.
Accessing custom field values on tasks or projects
The tasks reference has information on how custom fields look on tasks. custom fields will return as an array on the property custom_fields, and each entry will contain, side-by-side, the compact representation of the custom field metadata and a {typename}_value property that stores the value set for the
custom field.
Of particular note is that the top-level gid of each entry in the custom_fields array is the gid of the custom field metadata, as it is the compact representation of this metadata. This can be used to refer to the full metadata by making a request to the /custom_fields/{custom_fields_id} endpoint as described above.
In addition to @lpb 's excellent answer, if you’re referring here to the Asana memberships property, note that it’s not a custom field but rather is a built-in property on a task (and is plural, so you would ask for opt_fields=memberships):