Search code examples
asanaasana-api

Update task - change tags


Trying to update tags associated to a task:

Request:

PUT https://app.asana.com/api/1.0/tasks/286045228787956

Request payload:

{"data":{"tags":[157484377992312,157484408318898,285998759647376]}}

Response: 400 Body:

{"errors":[{"message":"tags: Cannot write this property","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}

Can we not edit task tags? Or am I passing wrong parameters?

Documentation does not help: https://asana.com/developers/api-reference/tasks#update


Solution

  • In order to edit tags on a task, you need to use the endpoints

    POST /tasks/<id>/addTag
    POST /tasks/<id>/removeTag
    

    as described in a different section of the documentation you referenced.

    The payload needs to be

    {"data":{"tag":<your_tag_id>}}