The asana documentation states that you can create a task within a workspace with the following code, which works:
workspace_id = '48673284270301'
client = asana.Client.basic_auth('asana_api')
client.tasks.create_in_workspace(workspace_id,{ 'name': 'new task'})
I also know you can create a project with the following code:
client = asana.Client.basic_auth('asana_api')
client.projects.create_in_workspace(workspace_id,{'name': 'new project'} )
However, I can't figure out how to upload a task under a certain project?
I've tried the following:
workspace_id = '48673284270301'
client = asana.Client.basic_auth('asana_api')
client.tasks.create_in_workspace(workspace_id,{ 'name': 'new task','projects':[{'id':48729403436686,'name': u'Larry (2100 Walnut)'}]})
Which sends me the following error:
File "build/bdist.macosx-10.6-x86_64/egg/asana/resources/_tasks.py", line 78, in create_in_workspace
File "build/bdist.macosx-10.6-x86_64/egg/asana/client.py", line 100, in post
File "build/bdist.macosx-10.6-x86_64/egg/asana/client.py", line 60, in request
asana.error.InvalidRequestError: Invalid Request: projects: [0]: Not a recognized ID: [object Object]