Home    |    GitHub Page    |    API    |    FAQ

How to sort list of results from joplin.data.get() API?

For example, I want to get a list of all notes from a specific folder, sorted by their order value.

My current data access looks like this:

let notes = await joplin.data.get(['folders', selectedNote.parent_id, 'notes'], { fields: ['title', 'parent_id', 'order'] });

My question now, is it possible to directly sort the results within the joplin.data.get() API or do I need to sort them manually afterwards?

See the pagination section there for v1.4: https://joplinapp.org/api/references/rest_api/#pagination but please don't implement this yet as I'm just about to change the API (shouldn't change after that).

That's perfect! Thank you for your fast response!
I will implement this as soon as the API is stable.

Just one more short question...
I have to consider the pagination also in data requests from plugins, right?
So it could be possible that joplin.data.get() returns multiple "pages"?

Yes, same for the plugin API. Any end point that might return multiple object will be paginated.

Alright. Then I have to add this behavior too.

Thanks again! :grin: