Trying to pull specific Task's information but reponse doesn't include relevant fields

I’m using the asana module in order to access API
My objective is to get tasks information and specifically descriptions.
Here’s my code line of the get request:

result = client.tasks.get_task(task_id, {'param': 'value', 'param': 'value'})

The response simply include a lot of ‘enum_options’ , without the fields I require
Unfortunately, couldn’t figure by myself what’s wrong , and the API docs show that I don’t need to add/omit anything from the code.

I’m sharing the JSON I’m getting in response, for better understanding, (the *** are hidden gids edited by me)
please note the “custom_fields” array which should have included the task description :

{‘gid’: ‘**************’, ‘assignee’: {‘gid’:*************, ‘name’: ‘Asaf Shtrul’, ‘resource_type’: ‘user’}, ‘assignee_status’: ‘inbox’, ‘assignee_section’: {‘gid’: ‘1200602043400127’, ‘name’: ‘Recently assigned’, ‘resource_type’: ‘section’}, ‘completed’: False, ‘completed_at’: None, ‘created_at’: ‘2022-02-20T10:19:25.554Z’, ‘custom_fields’: [{‘gid’: ‘537852508174241’, ‘enabled’: True, ‘enum_options’: [{‘gid’: ‘537852508174242’, ‘color’: ‘red’, ‘enabled’: True, ‘name’: ‘High’, ‘resource_type’: ‘enum_option’}, {‘gid’: ‘537852508174243’, ‘color’: ‘orange’, ‘enabled’: True, ‘name’: ‘Medium’, ‘resource_type’: ‘enum_option’}, {‘gid’: ‘537852508174244’, ‘color’: ‘yellow-orange’,

Please help:)


You need to ask for the opt_fields you want to see. Search the API doc for that keyword you’ll find explanations :wink:
Let us know if we can help further.

1 Like

Thanks for that!

Iv’e tried it also already-

First time with ‘custom_fields’ as field name

It shortened the JSON but still didnt supplied any new information.

Sec with ‘description’ , it returned a json with solely the gid.

Can you please elaborate regarding the right way to use opt_fields ?

What am I missing ?

You can look at the " Input/Output Options" section of the doc

Let us know if that helps