Ira
Ira

Reputation: 21

Can i post a task to a specific location in a project through asana API?

I'm trying to post a task within a project under a certain section, does anyone have any suggestions as to go about doing it/ is it even possible?

Thanks

Upvotes: 0

Views: 134

Answers (2)

Andrew Heinke
Andrew Heinke

Reputation: 189

To POST a new task to a project in a specific section (column) hit the workspace URL

https://app.asana.com/api/1.0/workspaces/[workspace-id]/tasks

You need to declare the memberships property in your POST request, the API documentation makes this very confusing.

Here is how it should be:

"memberships": [{ "project": 12345, "section": 12345 }]

The API documentation makes it seem like you need to also include the name that goes along with the project and section.

Here is their example from the docs which is NOT how it should be done:

[{ project: { id: 1331, name: 'Bugs' }, section: { id: 1123, name: 'P1:' } }]

I found this answer here: https://community.asana.com/t/how-create-task-with-membership-via-api/10481/2

Upvotes: 1

agnoster
agnoster

Reputation: 3784

Well, you are in luck! We are right now working on improving our support for sections in the API.

To add a task to a given section, you can use the addProject method with a section parameter, which is similar to insert_before or insert_after. An example call would look like POST /tasks/1234/addProject?project=111&section=7865.

Now, that's an extra call you need to make after you create the task, which is a bummer, so we're also working on a way to specify sections when you create the task. But we're literally working on that right now. I'll edit this answer when that exists.

Upvotes: 1

Related Questions