Copy task with subtasks and sub-subtasks via API

Question:

The GUI provides a nice way to make copy of a task with subtasks and associated tasks.

From what I gather, the API route is a bit convoluted.

  • Get original task’s information
  • Create new task based on that information
  • Get subtasks of original task and push them to the new task
  • Get new task’s ID, subtask IDs and match on subtask’s name to add sub sub tasks

Problems:

If you are matching on name and if the task name changes, your matching won’t work.
You would not know the ID of the new subtask to attach the sub sub task to until you you added the parent subtask. Then you would need get the subtasks of the new task to add the sub sub task to but again, unless you knew the ID, you would be matching on name of task.

P.S. I’d love to see a /tasks/:id/copy endpoint.

#saytaskonemoretime

2 Likes

Hi Steven,

I’m an engineer on our Platform team. I’ll pass along your feedback about a /copy endpoint. In the meantime, you can do better than just matching the name. Because you are the one creating the subtasks, you can store their IDs in your application, and remember that, for instance “new subtask 7890 refers to original subtask 1234”, and you can then go through your mapping of old->new subtasks and copy in the data they need (and repeat as necessary).

Hope that helps,
R.J.

3 Likes