How to update a task status via api?

Hello,

I am attempting to update the task status in Asana through API. However, the status does not seem to be updating.
{
“data”: {
“task_gid”:“${u_task_id}”,
“name”: “${short_description}”,
“assignee”: “${assigned_to}”,
“due_on”: “${due_date}”,
“custom_fields.display_value”: “${u_status}”,
“text”:“${work_notes}”
}
}

Name, Assignee, due on are updating through api in Asana.

A custom field’s display_value is a read-only property. To set the value of a custom field, you’ll need to update the appropriate value property; i.e. text_value, number_value, etc. In the case of an enum (i.e. dropdown list) field which I assume your status field probably is, you’ll need to update the enum_value property with the gid of the enum option that you want to set it to.

1 Like

Thank you, @Phil_Seeman ! .

I was able to update the task status values. Can you please help me with updating the work notes?

{
“data”: {
“task_gid”:“${u_task_id}”,
“name”: “${short_description}”,
“assignee”: “${assigned_to}”,
“due_on”: “${due_date}”,
“text”: “${work_notes}”,
“custom_fields”:{
“1195124002529750”:“${u_status}”
}
}
}

Excellent news!

That could mean one of two things - I’m not sure which you mean - are you wanting to update the task’s Description field, or wanting to add comments (i.e. at the bottom on the task’s detail pane)?

For the Description field, you can either update the task’s notes field if you just want to use plain text, or you can update the html_notes field if you want to include HTML (but note that Asana’s HTML is only a subset of full HTML and also has some unique syntax elements to it).

If you’re wanting to add comments, a comment is a Story in the API, so you’ll want to use the Create story endpoint.

@Phil_Seeman Please see below

Response: {“errors”:[{“message”:“No matching route for request”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Errors”}]}

@Srujan_Chilumula,

Are you calling it as a POST? (It won’t work with a GET or PUT.)

@Phil_Seeman I changed it to POST and receiving the below error.

Thank you, @Phil_Seeman !

I fixed the issue. I was able to update the comments.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.