How to get the custom fields when getting the project?

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.


`1

Welcome, @Shahidul_Islam_Prant,

You need to ask for the field custom_fields which will return an array of all the custom fields for the task.

Here’s info from Build an app with Asana

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.

curl --request GET \
     --url 'https://app.asana.com/api/1.0/tasks/9999999999999?opt_fields=custom_fields' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer 0/...'

Larry

1 Like

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):

image

1 Like

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