Adding a task to (the top of a) section

I have seen in a previous API reference doc that when moving a task to a different section it was inserted at the top. However, the current behavior and doc states the opposite: “the task will be inserted at the bottom of the section”.

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

These parameters should work equally well for a board 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.

That makes a lot of sense. Thanks @Joe_Trollo for the clarification!

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.

Note that since we are deprecating task-sections, this endpoint will not accept them as valid sections.

1 Like

Thanks @Kevin_Quicho for the update! Will test that endpoint as soon as I can.

@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.

Hi @Tim_Oertel, thanks for pointing that out. We’ve recently moved our docs over here and the true docs should have the correct information.