Add a project to a task
/tasks/{task_gid}/addProject Required scope: tasks:write
Adds the task to the specified project, in the optional location specified. If no location arguments are given, the task will be added to the end of the project.
addProject can also be used to reorder a task within a project or
section that already contains it.
Positioning the task:
- Use
insert_beforeorinsert_afterwith a task ID to position relative to another task - Use
sectionalone to add the task to the end of a section - Use
sectionwithinsert_after: nullto add to the beginning of a section - Use
sectionwithinsert_before: nullto add to the end of a section - Use
sectionwithinsert_beforeorinsert_after(non-null) to position relative to a task within that section. The anchor task must be in the specified section.
At most one of insert_before or insert_after should be specified (both cannot be used together).
A task can have at most 20 projects multi-homed to it.
Returns an empty data block.
Parameters
path Path Parameters
| Name | Type |
|---|---|
task_gid
required
The task to operate on. | string |
query Query Parameters
| Name | Type |
|---|---|
opt_pretty Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. | boolean |
Request Body
The project to add the task to.
Responses
Successfully added the specified project to the task.
Client Errors
This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
errors?:
}
A valid authentication token was not provided with the request, so the API could not associate a user with the request.
errors?:
}
The authentication and request syntax was valid but the server is refusing to complete the request. This can happen if you try to read or write to objects or properties that the user does not have access to.
errors?:
}
Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.
errors?:
}
Server Errors
There was a problem on Asana’s end. In the event of a server error the response body should contain an error phrase. These phrases can be used by Asana support to quickly look up the incident that caused the server error. Some errors are due to server load, and will not supply an error phrase.
errors?:
}