Search code examples
asana

Can I add a Story to an Asana Project via the API?


According to the documentation at https://asana.com/developers/api-reference/stories, I should be able to create a Story for either a Task or a Project.

POST /tasks/task-id/stories
POST /projects/project-id/stories

However, I'm having no luck adding stories to projects. The error message is pretty straightforward, "Cannot comment on this object". It would appear that there is no way to do this in the web UI either. Does this just mean that the API documentation is incorrect?

Add Story To Task - Works

curl -u $ASANA_API_KEY: https://app.asana.com/api/1.0/tasks/4646321361313/stories -d "text=This is a comment"

--- RESPONSE ---
{"data":{"id":4646330012437,"created_at":"2013-03-22T20:23:45.645Z","source":"api","type":"comment","text":"This is a comment","created_by":{"id":1071358442997,"name":"Chris LoPresto"},"target":{"id":4646321361313,"name":"Here is a task"}}}

Add Story To Project - Doesn't Work

curl -u $ASANA_API_KEY: https://app.asana.com/api/1.0/projects/4646342124006/stories -d "text=This is a comment"

--- RESPONSE ---
{"errors":[{"message":"target: Cannot comment on this object"}]}

Solution

  • I assume that the documentation was wrong when you posted this, and has been fixed in the year since.

    In the Stories section of the API doc, it says:

    Stories are a form of history in the system, and such they are read-only.

    It also says about the story target attribute:

    target - read-only. The object this story is associated with. Currently may only be a task.