Regarding creating a task

Hi,
I need to know how to create a task to a project using API. I have gone throw the API doc’s but i can’t able to find the solution. In create task page you have mentioned to pass workspace id in parameter but there is no way to create for project.Awaiting for your response.

Thank you,
Regards,
Thiyagaraj.G

Hi @Cliqtrix-1 and welcome to the Forum :wave:t3:

Let’s see if we can fix that together! Can you try to follow these steps?

  1. Access the following URL: Build an app with Asana
  2. Select "Explorer
  3. Authorize your account by clicking on the red banner.
  4. Then, select the “POST /tasks/:task/addProject” option above “Resource Description.”

From there, you will be able to enter your attributes in the fields below and, thanks to this page, you should be able to obtain the right query in order to post a task in a specific project (See screenshot below)

Hope this helps! Let me know if you have any follow-up question!

1 Like

Hi @Marie,
Thanks for your reply.
I am asking about while create a task itself i need to assign it to a specified project.
By using this way “POST /tasks/:task/addProject” i need to pass task id right? How i know the task id before creating a task.
The solution you have suggested seems i need to under go two process

  1. 1st i need to create a task under a workspace.
  2. Then using the task id i need to add to a project.

Instread of doing this much process while creating a task we can pass the workspace id and project id in parameters. So that, task will be created under a project it seem to be better way.

Regards,
Thiyagaraj.G

Thanks for the follow-up @Cliqtrix-1!

Yes you’re completely right, you first need to create your task and then create a loop to link this task to the project you want to associate it with. Our API doesn’t allow you to directly create a task in a specific project at once. Hope this helps; let me know if you have additional questions!

Thanks @Marie
Is there API to Complete the task?
I did’t seen any API to complete the task. For only getting the completed task API is there.

Regards,
Thiyagaraj.G

Any update on this?

Regards,
Thiyagaraj.G

@Cliqtrix-1 To complete a task, set the completed property when updating the task. (Asana will automatically set the completed_at property when you do this.)

1 Like

Hello Firstly ,good work I wish. I’m an university student on computer engineering .I’am improving api between a special company - Asana for my carrier .But i have question about task submit into project .As you can see my form on the picture ,I have two forms and ı have created so submit projects and tasks into Asana .Everything is great But Tasks are free. How can ı send into a project this Task ?
Thank You So Much
Have A Nice Day

@Hikmet_Tuzuner,

You’ll have to determine how you want to prompt the user on your “add task” form for the project to put the task into. From an API perspective, when you create the task, you can use the projects parameter on the task object to associate the task to one or more projects.

1 Like

Hello fisrtly ,good work I wish. Thank you for answer .I have updated my form.
Have a nice day .