Bulk API endpoints

I’m developing a plugin for neovim such that i can easily create rems from my code. The goal is to be able to use remnote as both snippet manager, note-taking tool and spaced repetition app.

Currently, sending works really well, however querying is way too slow - I’d ideally would be able to recursively retrieve all rems in a document (and then use the neovim fuzzy finder to filter it down and insert the code block). This takes, for a small document, well over 30s.

Is there a way to retrieve (or send/update) rems in bulk?

2 Likes

There are no bulk operations at the moment. But even if there were (I assume you are using the backend API) it might still be too slow for a < 30ms response time which is required for a snappy, responsive feeling.

So you might have to implement some caching anyway. E.g. periodically load the #Snippet tag and check for any new tagChildren.

Another option is to download a JSON backup and operate on that. Depending on how frequently you modify snippets a manual download might be enough. For Roam there are tools using Puppeteer to do it automatically, e.g. daily. This should work for RemNote too I think. If you are using the desktop app the backups are generated daily in your Documents folder automatically.

Still another option would be to use a frontend plugin connected to a localhost server (opened in an additional browser tab to be loaded all the time). See GitHub - hannesfrank/remnote-local-server: A quick&dirty demo of how to communicate between RemNote and the OS using the Frontend API. for a demo of the architecture.
This is really fast since no http requests to RemNote servers are required. And it also works on local-only KBs as well.

RemNote’s extension system is currently reworked so there might be some progress here the next month or two.

2 Likes

Thanks @hannesfrank super helpful/good ideas, I’ll play around w/ the options. I think combination of local caching for daily updates and rely on desktop app for longer can work and would avoid redundant space usage. I’ll also play around w/ the local server