Filtering using tasks endpoint, not advanced search

According to the API documentation:

Use one or more of the parameters provided to filter the tasks returned

It looks like I can query for tasks:

  • assigned to X
  • In section Y
  • modified_since 2019-04-01
  • incompleted (completed_since=now)

But, it just don’t work.

The modified_since and completed_since are ignored if I filter by section.
And, I can’t filter by section or project AND assignee at the same time… we can only filter by 1 item, so we fetch too much data, sometimes lots of pages, to show only a few at the end when using client filtering.

When trying to combine multiple filters (other than dates), we get an error.

Must specify exactly one of project, tag, section, user task list, or assignee + workspace

That’s not what we understand from the /tasks documentation!

I know the advanced filtering can do this, but some of users are not allowed to use it.
Are you planning to allow this “one or more” parameter filter on the /tasks endpoint?

Hi @Frederic_Malenfant, sorry for the confusion here. The filters available in the API are limited by the indexes we have in our database. As the web product evolved, we had a number of separate indexes built to support different kinds of filtering in the UI, and the API added these to the list of filters apps could use. However, because filters are not all built on the same index, they’re not all compatible with each other and, as you’ve noticed, sometimes they’re ignored.

As part of the work outlined in Sections are dead! Long live sections!, we are building and backfilling a new index to support the new canonical structure for tasks, and I anticipate that we will be able to unify the filters that are available in the API. Unfortunately, I don’t yet have a timeline for when the new index/filters will be ready for use.

Notably, the “assignee” filter here is misleading. The “Must specify exactly one of…” message will continue to be true in that you can only specify one container in your filters. “Assignee” wasn’t originally meant to be a filter on the assignee field on tasks, but rather one half of “assignee + workspace” which is a filter on the container. “Assignee + workspace” is how we used to describe “user task lists” before we had full support for them in the API. This is why you get an error when trying to filter on assignee and project—the API interprets this as you trying to filter to two containers. Depending on the cost, we may clean up how these filters work, but I don’t have any concrete plans to share at this time.

1 Like