I am not able to create multiple task under a project in a single call to Asana.
Hi @Soumen_Jana,
No, not possible - it’s one task per API request.
However, you can use the Batch API to submit multiple requests at a time - check out the docs for the Batch API for details.
Hi @Phil_Seeman,
I have tried to push multiple tasks using BATCH API.
Please see the payload below :
{“actions”:[{“relative_path”:“/tasks”,“method”:“post”,“data”:{“workspace”:“967840855208084”,“projects”:[“982858752611718”],“notes”:“Geo Behavioural Audience”,“name”:“Geo Behavioural Audience”,“assignee”:“967839896278404”}},{“relative_path”:“/tasks”,“method”:“post”,“data”:{“workspace”:“967840855208084”,“projects”:[“982858752611718”],“notes”:“IO Revision”,“name”:“IO Revision”,“assignee”:“967839896278404”}}]}
Response :
{“errors”:[{“message”:“Bad Request”,“help”:“For more information on API status codes and how to handle them, read the docs on errors: Build an app with Asana”}]}
Any idea what i am missing here?
Thanks.
Bingo!!!
I’m able to troubleshoot this issue. There was some issue with Payload which i fixed
Correct Payload :
{“data”:{“actions”:[{“relative_path”:“/tasks”,“method”:“post”,“data”:{“workspace”:“967840855208084”,“projects”:[“982858752611718”],“notes”:“Geo Behavioural Audience”,“name”:“Geo Behavioural Audience”,“assignee”:“967839896278404”}},{“relative_path”:“/tasks”,“method”:“post”,“data”:{“workspace”:“967840855208084”,“projects”:[“982858752611718”],“notes”:“IO Revision”,“name”:“IO Revision”,“assignee”:“967839896278404”}}]}}
Thank you @Phil_Seeman for your help.