How to open existing notes using the API?

I'm making a a plugin for Krunner launcher, and I would like to open specific notes when they're selected. I'm using the desktop app. Is it possible using the API?

With the external Data API you can't read the actual opend note as it is not possible to read out which note is currently open, but with the Plugin API this is possible.

const slectedNote = await joplin.workspace.selectedNote();
1 Like

Actually you can use data api to open, refer to action api

I created a joplin-api npm package, you can use noteActionApi.openAndWatch, reference: joplin-api/NoteActionApi.ts at master · rxliuli/joplin-api · GitHub

1 Like

This is perfect thank you. Any way to open in the Joplin editor rather?

As far as I know, no, if you manipulate joplin data more and don’t need to strongly associate joplin itself, you can use data api, otherwise you can only choose plugin api

Can I use Plugin API for scripting outside of plugins? I can't find the package anywhere

No, it's only for plugins.

1 Like

This is not possible, but you can use workarounds, such as creating a plug-in to provide a local http service, and then calling it in an external script.

E.g

/api/note/action/open?id=***

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.