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)
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'})