Btw, you might be interested to know that if you activate the Web Clipper service, you can interact with Joplin's REST API on port 41184. I have been using a hairy mess of shell scripts to achieve similar functionality (Joplin-as-CMS).
I'll have to clean it up and put it on GitHub this weekend!