Issue with task creation. Please help

We are doing following process through ASANA API…

1) Task creation.
2) Assigning created task to couple of projects.
3) Attaching one image file to task.

It is working perfectly fine with 3 tokens we had previously created on ASANA. But same code with other user tokens is returning Error 400. From our end we are just changing user token and other stuff we send to API is same. We noticed that task is being created in-spite of Error # 400 but it is not being assigned to projects and it is not saving image file.

Question here are... 

A) Why it is not working with other user tokens? 
B) Is there anything related to access permission or something on ASANA? If yes then please tell us any required steps.
C) Why it is working partially with some user tokens?

Please provide your views. Thanks.

Hi @Nishant and welcome to the forum!

I’m not sure why you posted your question inside of a blockquote but it makes it hard to read due to having to scroll to read it all.

I’m re-posting it here without the block so it’s easier to read:

============

We are doing following process through ASANA API…

  1. Task creation.
  2. Assigning created task to couple of projects.
  3. Attaching one image file to task.

It is working perfectly fine with 3 tokens we had previously created on ASANA. But same code with other user tokens is returning Error 400. From our end we are just changing user token and other stuff we send to API is same. We noticed that task is being created in-spite of Error # 400 but it is not being assigned to projects and it is not saving image file.

Question here are…

A) Why it is not working with other user tokens?
B) Is there anything related to access permission or something on ASANA? If yes then please tell us any required steps.
C) Why it is working partially with some user tokens?

Hi @Nishant,

As part of the error return, there is a message parameter that will contain a text description of the error. Check that as it should give you more of a clue as to what the problem is. (Feel free to post that message here if you’re still stumped.)

Hi Phil. Thanks for reply. I am just getting “error 400” but still task is created (but like I mentioned). Same code works fine with 3 users but not with other (all users are under same account). So is there something like permission?

Hi @Nishant,

400 is “Bad Request” in general, but that’s pretty broad.

Asana always returns a text message along with its errors, so it’s in the returned data somewhere - if you can find it, it would likely help you know what’s going on.

I have seen Bad Request errors come from permission issues. Since it’s working for some users but not another, yes, I would suspect a permissions issue.

Yes Phil. How can we grant permission if such case?

Because you say the task is being created but not assigned to projects, that sounds like the permission issue is that this user does not have access to one or more of the projects you’re trying to add the task to. You’ll need to figure out which project(s) those are, either by looking in the Asana web UI or by debugging the code, adding to each project one at a time and seeing which project(s) it fails on.

It could be as simple as adding that user as a project member, but not necessarily, especially if Teams are involved - Asana’s permissions model can be fairly complex at times. See here for more details on that.

OK, I will check that way. Thanks for all your help.