Does Joplin Server have the API

There's a set of Node-RED nodes (node-red-contrib-joplin) that use the Joplin API to enable search, update, delete, get attachment, get, getby parent, and create. I've dabbled in using it to enable Home Assistant to "self-document" it's configuration and/or state information about my home in Joplin. To me, the integration of Node-RED and Joplin creates some amazing capabilities.

Using the nodes, you can access the API of the Joplin instance running on a different machine. Joplin's API has a security "feature" that only allows access from the same machine, but you can work around that by using a proxy to mirror the API requests received from a remote machine so they appear to the API as a local request.

Here are my notes on the procedure that I used, if it's any use:

Install node-red-joplin-contrib Nodes to the Node-RED Pallette

  1. Launch Node Red
  2. From the menu, select Manage Pallette
  3. Select the Install tab
  4. In the Search Modules field, enter node-red-contrib-joplin
  5. Click Install

Configure the Joplin Data API

  1. In Joplin, Tools - Options - Web Clipper
  2. If not already activated, activate the Web Clipper Service as it is required for the Jopln Data API to run.
  3. In the Web Clipper configuration section, copy your Authorization Token as it will be required to configure the Joplin Configuration node in Node-RED.

Configure Access to the Joplin Data API

The Joplin Data API listens on port 41184, but it only binds to 127.0.0.1 to accept traffic from the localhost only. Requests originating from other hosts will be refused. To circumvent this "security feature", implement a port proxy on the system hosting Joplin. The port proxy will listen for requests on a port other than 41184 from hosts other than the localhost and will retransmit the request to 41184 on the localhost.

For Windows 10, the built-in command, netsh, can perform this function.

  1. To activate a port proxy to listen for requests from any host on port 41185 and retransmit them to 41184 on the localhost, execute the following command
 netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=41185 connectaddress=127.0.0.1 connectport=41184
  1. Open port 41185 on the firewall, if present. If using the built-in Windows Defender, this can be accomplished one of two ways:
    1. Use netsh to add a new firewall rule: netsh advfirewall firewall add rule name="Open Port 41185" dir=in action=allow protocol=TCP localport=41185

    2. On modern Windows machines, this can also be done via PowerShell commands: New-NetFirewallRule -Name JoplinAPI -DisplayName "JoplinAPI 41185" -Direction Inbound -Protocol tcp -LocalPort 41185 -Action Allow -Enabled True

To deactivate the port proxy:

  1. Execute the following command
    netsh interface portproxy reset
    
  2. To close the previously opened firewall port either:
    1. Remove the firewall rule using netsh: netsh advfirewall firewall del rule name="Open Port 41185"
    2. Remove the firewall rule using PowerShell: Remove-NetFirewallRule -Name JoplinAPI 41185