Raspberry PI 4 with API only

Hello! First off, this forum and the documentation page have been immensely helpful getting me started with this project.

I’ve a custom UI running on windows (C#, WPF) that communicates with capturegrid4.17 running on a RPi4B+. The pi is running ubuntu server 20.04, with the capturegrid4 snap installed (confirmed to be running by opening CG on the windows machine, it sees pi node with cameras connected, all seems ok).

I originally had CG running locally on the windows machine for convenience, using for listening/sending requests, and it seems to be working well. ZMQ/JSON has been easy to work with!

I’ve now moved onto the next phase of moving CG to be on the Pi only, with my application just communicating via the API, and I’m having trouble talking to it. I’ve triple checked my IPs (Windows is, pi is staticly set to, disabled firewalls on both devices.

On the pi, “netstat -lt” shows localhost:54543 and localhost:54544 listening when CG snap is running - which I understand to mean it is ONLY listening on those ports from itself, not opening them up to my network. I haven’t seen a configuration file of any sort for the snap, is there someway to change this from localhost only to (any interface)?

Thanks in advance!

Yes it should be possible to get this working, by changing some of the app’s options.
By default, the endpoints for the External API are local only.

On the Windows version, this is easy to do.
You would:

  1. Go to the Options window
  2. Go to the External API tab
  3. Change the endpoints for the event server and request/reply server.
    The app will internally using those endpoints with the ZeroMQ “zmq_bind” API, so you can refer to that for the acceptable values. See:

On the linux/snap version, its still possible to customise this option, but you need to manually edit the config file. The config file is called “capturegrid4_options.json”, and it contains two fields called “apiServerEndpoint” and “apiPublisherEndpoint”. So, you need to make sure the app is not running, and then edit the config file.

To locate the config file, look in the app’s log file.
To view the log file, run this command:

snap logs -n all -f capturegrid4

And search for something like (this is from the windows app, but the linux app is similar but just a different path):

[11:46:00.872      App     Info:  0] options loaded from: C:\Users\francis\AppData\Roaming\CaptureGRID 4\capturegrid4_options.json
1 Like

Francis, Thanks for the fast and helpful reply. I was able to find and change it no problem, worked immediately.