Search tasks in a workspace error only custom fields

Good morning everything is fine?
I’m using the API to pull completed taks within a period of time, and there are 2 custom_fields that I would like to pull, which would just be the GIDs 1207251090649455 and 1204219176386539.
I put “custom_fields.1204219176386539.value” as a parameter in the query for example and it returned all the custom_fields of the tasks without their values, can anyone help me?

Hi @Pedro_Malaquias and welcome to the forum,

I’m going to assume you’re using the Search API.

You can’t get just certain custom fields returned. in the Asana API you always get all custom fields on a task and you’ll have to use just the ones you’re interested in from what gets returned.

The custom field parameters you’re trying to use are not for identifying which custom fields should get returned, they are for filtering out which tasks get returned based on certain custom field values. That’s not relevant in your case so you should remove that parameter.

If you include ?opt_fields=custom_fields in your call, that should return you all of the custom field data for the tasks that get returned. See the docs for more on opt_fields.

You should use the opt_fields parameter in your query. Structure it like this: opt_fields=custom_fields.1207251090649455.value,custom_fields.1204219176386539.value. This will return only the values for the specified custom fields.