Retrieving updated subtasks

Hey,

I’m wondering whether It’s possible to track subtask updates.

I’m using the /tasks endpoint with modifiedSince, which is simple and works well for regular tasks. My assumption was that it would also return updated subtasks, which doesn’t seem to be the case.

Thanks in advance.
Peter

Hi @Petr_Ježek , welcome to the forum !!

Using the /tasks endpoint, you will only receive subtasks that are specifically set to the filtered project or assignee you filter. Most of the time, they are not, so that endpoint doesn’t return them.

To get all updated subtasks since yyyy-mm-dd, you will need to use the special “search” endpoint.
https://developers.asana.com/docs/search-tasks-in-a-workspace

example:
GET /workspaces/xxx/tasks/search?opt_fields=modified_at&is_subtask=true&modified_at.after=2022-08-31T18:19:52.398Z&limit=100&sort_by=modified_at

If you add a “?projects.any” parameter, and you specify the project gid of parent tasks, your subtasks will NOT be returned, as there’s no inheritance between tasks and subtasks, and by default, subtasks are not set to any project, even if the parent task is member of a project.

So, most of the time, you will need to query all subtasks for the whole workspace.

Also, the pagination is not working in the search endpoint like it is in all other, there’s no “offset” in the response. You need to query the next 100, based on the “modified_at” of the last task returned in the previous page.

1 Like

Hi, thank you for your quick reply!

I tried getting subtasks via your suggested method, however I’m getting odd behaviour.

Sometimes changing subtask fields - either regular fields like task name or a custom field won’t make it show up in the search.
Also, creating a subtask does seem to trigger an update of the parent task, however the subtask itself doesn’t appear in the search.
I believe I’ve read a post about subtask update events not being triggered 100% of the time (I may be wrong). However if that’s the case, I’m wondering how to catch all updates reliably.

Thanks.

I don’t know if some subtasks changes doesn’t show in the search engine. I know that editing a subtask does not affect the parent, but adding or removing a subtask should.

Also, the /search endpoint is a separated index engine, and it can take a little time between the real update and the availability in the /search endpoint. If you tested too quickly, that may be the case.

1 Like