Updating Task status value automatically using API

Hi Team,

How can i update task status from Hold to complete.
So we have custom fields for tasks status HOLD, IN-PROGRESS and COMPLETE .
I am integrating application with asana and i am calling api using curl to update task status. How can i update task status from HOLD to IN-PROGRESS or from IN-PROGRESS to COMPLETE using api call?

Hi @Rohit_Phadatare,

Assuming your task status field is an enum custom field, you’ll need to get the gid for each of its enum options, which you can get from this endpoint.

Then you can update a task with the desired enum option by using this endpoint to update the task, and include the gid for that desired enum option.

Hi @Phil_Seeman , Thank you for the reply.
I have tried as per your suggestions below
curl -X PUT https://app.asana.com/api/1.0/tasks/1202463664446973 -H ‘Content-Type: application/json’ -H ‘Accept: application/json’ -H ‘Authorization: Bearer ’ -d ‘{“data”: {“enum_options”:{ “1135443121048218”:“Complete”}} }’
This doesn’t update status to complete. I have attached image for better understanding. In image you can see status is IN-PROGRESS and i want to change it to COMPLETE automatically after task completion.

If possible can you give me example or can you mention api with required field

image

Two things to fix:

You want “custom_fields”, not “enum_options”.

And for the value, you don’t pass the text value of “Complete”, you have to determine the gid for that enum option and pass that gid.

You can get the gids for all of the enum options for a custom field using the first endpoint I linked to in my post above.

Hello Phil,
THank you i am able to change. I was mentioning enum_option in data field but i should also mention custom id, after that i am able to do it.

curl -X PUT https://app.asana.com/api/1.0/tasks/1202463664446973
-H ‘Content-Type: application/json’
-H ‘Accept: application/json’
-H ‘Authorization: Bearer ’
-d ‘{“data”: {“custom_fields”:{“custom_ID”:“enum_optionID”}}}’

1 Like