Snap which provides a ReSTful API

My snap has a web interface provided by Jetty and also provides a ReSTful API.
My snap is built on code which was originally a non snap classic Ubuntu application.
The web interface worked straight away without any special modifications for the snap environment.
However the ReSTful API is not accessible, I gete Error 404 Not Found.

Are there any reasons why the ReSTful API would be blocked in the .snap ?

I can only provide follow up questions:

  • I the network interface enabled for the apps entry providing the API?
  • Is there a service already using the port?
  • Are there any errors in the logs? sudo journalctl -u snap.<snap-name>.<app-name>.service
  • Are there any denials? dmesg | grep DEN

Hi Jenny,

My guess is that this is a red-herring, in the sense that being a REST API or not is a high-level detail which snapd has no control over. It’s simply an open port as far as it’s concerned, and the fact you get a 401 means the open port is working (application managed to bind to the port, listen, and respond) and external clients are reaching the application, so all seems well.

If the application isn’t working as it should, there’s most likely something else going wrong, such as a configuration that isn’t quite right, or a local path that the application would like access to but cannot. Logs sometimes help in those cases (look for DENIED in dmesg), but there’s also the possibility that the application is simply looking for something in the wrong location and that needs to be fixed. With some luck the application will point out what the issue is either to stdout/err or to logs as well.

Thanks for the replies. I will check out the denials / errors. I can’t do it straight away.

The ReSTful API works fine now under snapd. The problem I had was related to a classpath in the Java build.