Query API

Hi all,

I'm trying to work with the joplin.data API to retrieve all ToDos from Joplin but ignoring certain folders. To achieve this, I have tried to use a query, but it doesn't change the results at all. It currently looks like
query: is_todo = 1 AND parent_id NOT IN ("${Array.from(ignoredFolderIds).join('","')}"),`

Since I haven't found any documentation on the query, I feel rather lost. Does anybody has experience with this?

PS: I want to filter the result from the API since it seems easier on the ressources. Is this impression correct?

After digging a bit deeper and also better understanding the Joplin data API I have worked out a way how I can use the query in the Joplin App Search, but I have not been able to use it inside the plugin.
Some of the plugin APIs also refer to some examples, but I havent found any of the data API using the query option.

Are there any such ressources?

Please show what you have tried

Sure,

I've tried just to use one parameter so far for filtering the type. I've used

joplin.data.get(["notes"], {
            fields: ["id", "is_todo", "todo_due", "todo_completed", "title", "created_time"],
            query: "type:todo",
            page: page_idx}
joplin.data.get(["notes"], {
            fields: ["id", "is_todo", "todo_due", "todo_completed", "title", "created_time"],
            query: "type=todo",
            page: page_idx}
joplin.data.get(["notes"], {
            fields: ["id", "is_todo", "todo_due", "todo_completed", "title", "created_time"],
            query: ["type:todo"],
            page: page_idx}
joplin.data.get(["notes"], {
            fields: ["id", "is_todo", "todo_due", "todo_completed", "title", "created_time"],
            type: "todo",
            page: page_idx}

The query always returned all notes. Sadly I haven't found an example or further documentation.

Also my goal is to combine multiple query criteria, to also exclude folders "-notebook:Test"

Your examples are all for the notes which is for Gets all notes not searching!
To search a note, you need to use the search endpoint.

          queryNotes = await joplin.data.get(["search"], {
            query: "type:todo iscompleted:0",
            fields: "id, parent_id, title",
            order_by: "title",
            order_dir: "DESC",
            limit: 50,
            page: 1,
          });

For more infos,which filters are available in the query, read the documentation section search-filter.
The filters work 1 to 1 in the Joplin GUI, so if the query doesn't work there, it won't work in the API either

Thank you so much! This works like a charm