What API Endpoint to Use to See the "Selected" Option on a Custom Field for a Task

custom-fields
api
#1

Hi!

I’m trying to figure out the API endpoint structure to get the “selected” or “chosen” custom field option among a list of options. I’ve made a request, and been able to see the whole list of options on a custom field, but it doesn’t show which one is actually selected.

For example, let’s say we have a custom field called “Location” with 3 options (city, country, beach). Let’s also say the option “city” is selected. How could I make an api call on a task to see that for the custom field “Location”, the “City” option is currently selected? Thanks in advance for any help!

31%20PM

#2

Hi @John-Paul_Cody, It’s GET /tasks/:task and look at custom_fields[n].enum_value.name.

Larry

2 Likes
#3

That worked, thank you! I did have a follow up question that’s related. Do you happen to know if it’s possible to see this same information with a get request at the project level. For example, I have 100 tasks in 1 project, and don’t want to have to make 100 api calls for each individual task to see its custom field data. Is it possible to make 1 project api get request, and see this task specific data in that object? Thanks again for your help!

#4

https://asana.com/developers/api-reference/projects#get-tasks returns compact task records only.

https://asana.com/developers/documentation/getting-started/batch-api may be of help.

And also https://asana.com/developers/documentation/getting-started/search-api.

Larry

#5

Yes you can, use /projects/xxx/tasks?opt_fields=custom_fields,other-fields,…