Python API: best practice for task and subtask export

Good day everyone,
in order to calculate specific metrics I need to export the full list of task IDs from a series of specific projects. I have until now relied on a python script that extracts the main tasks and then iteratively checks and download sub-tasks (and so on for sub-sub-tasks).

Given the size of projects, this process is time consuming and inefficient. Do we have a “best practice” to get this data? Is there a better (and ultimately faster) solution to this?

Unfortunately the Global Export function cannot be leveraged as this exercise is limited to a specific project.

Thank you in advance!

@Pietro_Lunati - do you just need to extract the GIDs? If so, the way you’re doing it is, to my knowledge, the best way currently.

That said, if the scope/scale is limited, you could try just exporting the project to as CSV (or JSON). It should give you all top-level and subtasks (haven’t tested below that) and include the GIDs.

You can try the search endpoint, I believe it does include subtasks by default.

Hi, you may already be aware of this, but I wanted to point out that there is a num_subtasks field on a task which you can request and check before fetching subtasks. That can save a call for each task just to see if there are any subtasks.

3 Likes