0

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

Ira
  • 21
  • 6

2 Answers2

1

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.

agnoster
  • 3,744
  • 2
  • 21
  • 29
  • hi, thank you so much for your answer! one more quick question, what call would I use to add a task into a specific project? – Ira Jan 19 '15 at 20:45
  • also, am I able to create a new section through the api – Ira Jan 19 '15 at 20:52
  • `addProject` is used both to add a task to a project as well as position it (with insert_before, insert_after, or section). And a section is just a task that ends with a colon (`:`), so you can create one the same way you create a task (just make sure the name field ends with a colon, like `"P1:"`). – agnoster Jan 20 '15 at 10:51
  • hi again, one more question, what would I write as the data when I use the addProject with the Section parameter? – Ira Jan 20 '15 at 15:17
  • Ira - { project: [project id], section: [id of section task] } – agnoster Jan 20 '15 at 18:57
  • is there anyway to get the project owner? – Ira Jan 20 '15 at 20:00
  • Not currently, though we'll probably add this when we add things like project status. Not ETA on that as of yet, though. – agnoster Jan 21 '15 at 10:11
1

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