0

How to create subtask with python-asana?

I can create a task, but how to create subtask in the task?

client.tasks.create(name=task[0], projects=ASANA_PROJECT_ID, workspace=ASANA_WORKSPACE_ID, notes=notes)
surge_
  • 133
  • 1
  • 2
  • 9

1 Answers1

0

There is a convenience method on the tasks resource, add_subtask, that you can use. Also keep in mind that you can always call arbitrary routes in the API using the library's client().get(),client().post(),client().put() &client().delete() methods.

parent_task = client.tasks.create(name=task[0], projects=ASANA_PROJECT_ID, workspace=ASANA_WORKSPACE_ID, notes=notes)

client.tasks.add_subtask(parent_task['id'], {'name': 'This is a subtask'})

https://asana.com/developers/api-reference/tasks#subtasks

Andrew Noonan
  • 848
  • 6
  • 13