Get stories for all project's tasks

Hi!

I am exploring stories endpoint and I want to clarify its use.
As far as I understand, it is suited only for a one-time download of all stories of a task (
https://app.asana.com/api/1.0/tasks/{task_gid}/stories)
But:

  1. It is impossible to filter stories by the created_at attribute, so incremental update on a task is also impossible (upload only stories, whose created_at attribute is newer than the last updated one).
  2. The only way to get stories for all tasks in the project is to loop through ALL of them. We also do not have the means to check, which one has new stories and which one doesn’t.

Thank you!

You are right, you must get them one by one.

The first iteration can be long.
The next one will be faster, because I suggest to use the “search” api

And query for task in your selected projects (project.any=xxx,yyy)
and get tasks modified after the last time you query, with “modified_at.before=2024-07-19T23:18:45Z”.
Then, only get stories of these tasks to update your local copy.

1 Like

You could also consider webhooks or events to know more precisely when a story is added. It may end up being more complex to implement but more efficient in terms of fetching story updates.

@Dmytro_Horodetskyi,

When working with stories, also just keep in mind that because of Asana’s story consolidation, you won’t necessarily get ALL changes that occurred on a task from its stories.

2 Likes