Is there a way to revert that or to specify the position of the task in the new section? _insert_after_and insert_before seem to only apply to lists, no boards.
Thanks!
Background: at the Done section, when the tasks are automatically moved to the bottom makes it visually harder to grasp/understand which were the latest completed tasks in a project
insert_after = null puts the task at the top of the first board
insert_before = null puts the task at the end of the last board
You can’t specify section and insert_before in the same call.
It seems the only way to put it at the top of the section is first retrieving all tasks in a board and, after getting the id from the one at the top, using that id with the insert_before param. Which feels like a lot of api calls while before the API update it had the desired (and kind of expected) behaviour.
This action (adding a task to the top of a section) should be possible in our API. The API route is supposed to be POST /sections/<section-id>/addTask which would take task as a required parameter and insert_before and insert_after as optional parameters. However, we never exposed this route because we were (and still are) wary about exposing endpoints that have different behaviors for the two different kinds of “sections.”
Now that we are deprecating task-sections this world becomes drastically simpler. We will eventually be exposing this route, and I’ll update this thread when it’s live in production.
Hey @Rubs, POST /sections/<section-id>/addTask is now live in production. The endpoint will take in a task as a required parameter and insert_before and insert_after as optional parameters. If one of insert_before or insert_after are not provided, the task will be inserted to the top of the section by default.
@Kevin_Quicho Sounds awesome! Can you give details when this feature will be available for all? I just tested it and the console threw an error that this feature is not implemented yet.
@Kevin_Quicho@Joe_Trollo It looks like the docs are not up to date with the actual API. Took me some time to realize the docs were wrong, and your posts were correct…
The docs are in a section misleadingly called MOVE A SECTION IN A PROJECT and it says the API call is: POST /sections/{task_gid}/addTask where it should really be {section_id} as you say. Also, the required task parameter should be listed in the Parameters section. The error message when you leave out the task parameter (because I was setting task_gid instead…) wasn’t as helpful as it could have been.
The “Explorer” tab doesn’t include the sections resource at all, either. FYI.
"errors": [
{
"error": "ranked_list_at_most_one_of_before_or_after",
"message": "You can specify at most one of insert_before or insert_after.",
"user_message": "You can specify at most one of insert_before or insert_after.",
"help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
}
]