API Pagination and sorting

Hello,

has anyone already used the pagination API with sorting?
I have the problem, that the sorting is not workin?

Sorting works
http://localhost:41184/search?query=rechnung:0&type=note&fields=id,title,updated_time&limit=10&page=2&order_dir=ASC&order_by=updated_time&token=

Sorting does not work
http://localhost:41184/search?query=rechnung:0&type=note&fields=id,title,updated_time&limit=10&page=2&order_dir=ASC&order_by=title&token=

The problem i have with most fields, do i miss something?

Joplin Version 1.4.10

If you use js, you can try joplin-api npm package

It will be fixed in the next release.

1 Like

Hi @laurent

the field has_more is not always available.
In the query http://localhost:41184/folders?fields=id,title,parent_id&limit=20&page=1&token= the response has only the field has_more when more items available.

This is expected and documented I believe. has_more is true if there's more data, and it's either absent or false if there's no more data. Essentially you should check for truthiness.

Hm, in the documentation the field is labeld as always present?

Indeed you're right, and I see in the code that in some cases it's always set, and other cases it's not, so for consistency I'll always set it then.