Cockpit api with curl

Hello!

I’m trying to automate a series of tasks, like:

  • create x vpn connections with certain settings;
  • for those x vpns create rules on firewall;
  • etc (any other functionalities that are needed);

Before anything, I’m no developer. I know how to code something that works, but is not perfect.

My problem is, I’ld like from my machine (will be a vm later) to be able to run requests for nethserver to process, but how do I send a request to something like “/usr/libexec/nethserver/system-openssh/read”, is there a public url for a request like this one, or am I supposed to run all comands inside nethserver Terminal?

I’m planning on doing this in PHP, but any other language is fine if it’s better for doing what I want.
Sorry if it’s a dumb question, I’m really lost on what should I do.

Thanks to anyone that answers!

when you save something in the UI this is sent to the api, so open the web developer console (Press F12) then cp and paste the update api you can see

obviously this must be used locally, other said, in the terminal of your nethserver

Otherwise you can launch the same APIs remotely using ssh

1 Like

For some reason I cannot mark @giacomo answer as correct, but thanks both of you for the help.

I’ll create a connection via ssh like suggested by @giacomo.
@stephdl suggestion is also really helpful.

Have a great day!

2 Likes