Add Subtask to Task with Python API


#1

Hi all, I’m trying to do a simple action of creating a subtask and set it as Impediment. I’m using python ASANA API. My code is below as the error returned:

client.tasks.add_subtask(task[‘id’],{‘due_on’:due,‘name’:‘Sub task 5’,‘assignee’:user[‘id’],‘assignee_status’:‘later’,‘memberships’:[{‘project’:{‘id’:project[‘id’],‘name’:project[‘name’]},‘section’:{‘id’:section[‘id’],‘name’:section[‘name’]}}]})

InvalidRequestError: Invalid Request: memberships: [0]: project: Not a valid ID type: object

All vars are set in my environment. How to solve this issue?

Thank you.


#2

Solved.


#3

Hey @Breno_Carneiro_Pinhe, sorry for the late, reply here! Glad to see you worked that out! I’m marking this one resolved, hope that’s ok! :slight_smile: