Retrieve Subtask Ids from Parent task via API
completed
M
Mohammad Sohomow
It would be great if we could retrieve a list of Subtask ids in the response when querying a parent task via the Task & Tasks endpoints. It works great when looking up a subtask but requires sifting through all tasks in a list given a Parent task.
Log In
Canny AI
Merged in a post:
API Get Task Subtasks
J
Jared Van Kirk
Currently, it appears that to read subtasks of a task, you need to use the Get Tasks or Get Filtered Team Tasks calls with the subtasks boolean set.
It would be helpful to be able to include an array of the subtask ids for a given single task from the /task/{id} call. For example:
{
"id": "9hx",
"name": "Updated Task Name",
...
"subtasks":["123", "456"]
}
Perhaps it could also be controlled via subtasks boolean param as the current Get Tasks and Get Filtered Team Tasks supports.
G
Grzegorz Cieslik
Philipp Berner
Well that's not an answer for Mohammad questions, I also wonder why we have to list the thousands of tasks from list to get the subtask ids by the parent parameter. It makes the scripts slower and slower. This also increases the use of api calls, because it's limited to 100 task per call. So if I have 2000 tasks on list and only 50 are parents. To get the data of Parent:Subtasks I have to use 20 API calls instead of 1 ... .
Philipp Berner
completed
GET Task https://developer.clickup.com/reference/gettask offers the ability to also get sub-tasks via
include_subtasks
optionJohn
You can retrieve the subtasks with the parent in the getTask call by adding the include_subtasks=true parameter. This doesn't work with getTasks though because of the potential size of the response with 100 tasks and each of their subtasks.
T
Tereza Klobouckova
Another workaroung is using the endpoint "Edit a Task" and pass no data except the task ID. This endpoint returns array with subtasks.
N
Ny Nguyen
After some fiddling, I was able to get it to grab subtasks of a parent by adding an extra "parent" query parameter with the task ID as the value. Of course, it'd be much nicer to be able to grab that value from Get Task instead of having to jump through hoops.
F
Flavio Rinaldi
Ny Nguyen: can you explain how you did it?
N
Ny Nguyen
Flavio Rinaldi: Here's an example query
Using this as the endpoint, you'll get a list of subtasks under the parent task provided.