I want to get the total number of notes currently in Joplin from within my plugin.
I have not found how to do it in docs; the joplin.data API doesn't seem to have anything straightforward, and I didn't find any way to get it from sync status, or similar.
The use case for me is - personal stats. I already have a plugin that keeps a record of how many notes I'd edited in a given day (purely based on edit date).
I want to include the total number of notes in my base, so I can see how that evolves over time.
This data is currently sent to a service outside Joplin, and it's exported after every Joplin sync. That's often enough for me not to want to loop over all the notes every time it happens.
A /count endpoint would be appreciated.
It just occurred to me that in the meantime, I can hardcode the loop to start at, say, page 80, so the loop would be shorter
Good idea - if you keep track of the last page, you can resume from there next time. You might want to handle the case where notes have been deleted though, which would mean checking the previous pages if the current one is empty.
Nah, I'll just hard-code it to start at 80, I probably won't fall below that. And if I get too far above, I'll change the const to 90. Much simpler to implement.