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.

1 Like

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

1 Like

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.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.