Search code examples
curlasana

How to add tag to task using the asana API?


I am attempting to add a tag to a task using the following curl command as per the API:

curl -u <api_key>: https://app.asana.com/api/1.0/tasks/<task_id>/addTag -u "tag=<tag_id>"

When running the command I am prompted for a password and then get an error:

Enter host password for user 'tag=<tag_id>':
{"errors":[{"message":"Not Authorized"}]}

Actual values in <> are suppressed.

I got various read end-points to work correctly, but 'addTag' is not behaving as expected. Here is the documentation:

https://asana.com/developers/api-reference/tags

Anybody successfully using this end-point?


Solution

  • There was a bug in the docs (should be fixed since) - the -u flag is for user, the -d flag is for data. Try again, but with -d "tag=<tag_id>"?