REST API

REST API Server

TooLoo can be started as a server, with two endpoints:

  • / or /list

    • same output as the list-json command (see JSON Output).
  • /show/command_name

To start the server run the following:

tooloo serve <hostname> [port]

Hostname can be localhost, 127.0.0.1, 0.0.0.0, or any other valid hostname in your system. Port is optional and defaults to 6996

Quit it by hitting ^c or closing the terminal window.

To run it in the background launch it as follows

tooloo serve <hostname> [port] &; disown

Gotchas

IP Matters Outside Your LAN

If you're trying to access this from outside your local network, using something like DuckDNS external link icon , ngrok external link icon , or Tailscale external link icon the hostname or IP you choose will make a difference. You'll be best off tying it to the IP address that you have forwarding out through your firewall.

Race Conditions

TooLoo uses SQLite under the covers, and as such only one process can access the database at a time. This means that there is technically a small possibility that if a request comes in from the command line AND from the web server at the same time, the 2nd process will get an error about the DB being locked.

However TooLoo is a single user tool, so YOU would have to use the web server AND the command line at exactly the same moment, which would be very impressive, and if you manage to do it we want video. ;)

Should you be concerned about this? No.