Hi, I want to retrive all task (by project) and see their current section and move task to different section using API

Hi, I want to retrieve all tasks by project_guid, which I can - Using API explorer I’m using GET tasks and it can retrieve all the task but there is no information coming along about the task current section.

secondly, I want to move a task from one section “Todo” to another section for example “Doing”, there is something in docs about updating a task but I’ve no idea what will be the format of body when putting section_guid.

Looking forward to a response, thanks!


Hi @Mohisin_Raza , welcome to the forum!

To get additional fields, for all entities, you can use the “opt_fields” parameter, and ask the fields you need.
You can get the list of all available fields, by requesting one single task, and look at the fields in the result, example:

GET /tasks/xxx
Get a task – Asana

Then, query all tasks for one project, using:

GET /projects/xxx/tasks.
Get tasks from a project – Asana

You will get ids and name I think by default.

Then, you can add the opt_fields parameter:

GET /projets/xxx/tasks/?opt_fields=memberships.project.name,memberships.section.name
Input/Output Options – Asana

When you request “name” of an item, you always get the “gid” also in the response.

To add task 123 to a section 789, use this:

POST /sections/789/addTask, with that parameter: {data: {task: 123}}
Add task to section – Asana

1 Like