Is it possible create multiple Task in a single API call to ASANA?

integrations

#1

I am not able to create multiple task under a project in a single call to Asana.


#2

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.


#3

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: https://asana.com/developers/documentation/getting-started/errors”}]}

Any idea what i am missing here?

Thanks.


#4

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.