URL request of tasks with a single custom_field


We’re trying to retrieve a list of tasks with an optional custom_field, but there is a problem that the request like this (https://app.asana.com/api/1.0/tasks?project={project_gid}&opt_fields=custom_fields) works ok only with multiple custom_fields field. It seems to me that this is due to the fact that the custom_fields field contains many sub-objects with separate custom fields.

But I need only one separate custom_field by it’s gid to be extracted.

What I’ve tried already:

  1. tasks?project={project_gid}&opt_fields=custom_fields.{gid}
  2. tasks?project={project_gid}&opt_fields=custom_fields.{field_name}
  3. tasks?project={project_gid}&opt_fields=custom_fields.{field_name}.{field_type}
  4. tasks?project={project_gid}&opt_fields=custom_fields.{gid}.{field_type}

But it does not work.

Thanks in advance for your help!

Hi @Aleksandr11,

I’m 95% sure it’s not possible to retrieve just one custom field. You’ll have to get them all and find the one you’re interested in within your own code.

(Cc’ing @sasha_f @John_Vu for confirmation)

1 Like

Hello! Thanks for your answer. It is a little bit challenging for us then…
At least is it possible somehow to list multiple projects in one URL request of tasks?

I mean something like https://app.asana.com/api/1.0/tasks?project={multiple projects}&opt_fields=custom_fields

Not using that endpoint, but I would recommend checking out the Search API, which lets you specify multiple projects and also specific custom fields:

@Phil_Seeman is right. We don’t have a way to retrieve one custom field. You will have to get them all and do client side filtering in your code.

1 Like