Regarding creating a task

projects
tasks

#1

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


#2

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: https://asana.com/developers/api-reference/tasks
  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!


#3

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


#4

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!


#5

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


#6

Any update on this?

Regards,
Thiyagaraj.G


#7

@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.)