Unable to create Task using API in Asana

Hello,

I am trying to create a task under a workspace in Asana.

Payload i have prepared to push to Asana:
{“data”:{“workspace”:{“resource_type”:“workspace”,“name”:“cm-focus.com”,“id”:967840855208084,“gid”:“967840855208084”},“notes”:“Creative Update notes”,“name”:“Creative Updates”,“assignee”:[{“resource_type”:“user”,“name”:“Pradip”,“id”:967839896278404,“gid”:“967839896278404”}]}}

But i am getting a error message as response :
{“errors”:[{“message”:“workspace: Not a valid GID type: “object”.”,“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”}]}

I am not able to understand the reason as all the details available in the payload is correct.

Any kind of help on this is highly appreciated.

Hi @Soumen_Jana,

Don’t specify the whole object for the workspace and for the user; for each of those, just provide the ID.

I haven’t tested this syntax specifically but basically you want something like this:

{“data”:{“workspace”:“967840855208084”,“notes”:“Creative Update notes”,“name”:“Creative Updates”,“assignee”:“967839896278404”}}

2 Likes

Thanks Phil. That worked like magic however if i add another parameter to the request to associated with project , failing.

Sample Request Body : {“data”:{“workspace”:“967840855208084”,“projects”:[“967839896278404”],“notes”:“Creative Update notes”,“name”:“Creative Updates”,“assignee”:“967839896278404”}}

Response : {“errors”:[{“message”:“projects: [0]: Not the correct type”,“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”}]}

It’s mentioned in the API documentation that we need to send projects in form of array.

Thanks.

Please don’t mind my last comment.

Hi @Soumen_Jana,

If you have an updated version of your last sample which is working now, it would be great if you could post it - just so others who come upon this post later can see the working sample. Thanks!

I’ve got same problem. Can’t create tast in Asana using API.
Creating tasks with integromat.com service.
The scenario in integromat was working fine, and I did nothing changed in it. But It started to show the Error and stopped creating tasks in Asana

this is the error:

HANDLED ERROR

  • type

InvalidConfigurationError

  • message

400: projects: [0]: Not a valid GID type: number

Hi @11125,

What you’re running into is the fact that Asana has switched to using string IDs instead of numeric. For details, see:

and

1 Like