Connect to plumber API via linux username/password

Hey there,

I succesfully set up an R Server with RStudio IDE on a Digital Ocean Droplet.

I created a plumber API in RStudio Server and everything works fine when I start the API from RStudio Server.

But I have problems with connecting to the API from the outside. Is it possible to send the username and password for the linux machine everything is running on to get a response from the API? If not what else can I do? My colleagues would call the API from a node.js app.

Thanks!

When you run the plumber API from inside RStudio, it is accessed from within the RStudio connection to the server through a websocket.

If you want your API to be available to the outside, you have to run it in a separate process and expose it to the outside web.

  • Set up your API as a service.
  • Configure nginx, apached or similar web server to route request to a specific path to your plumber API.

Alternatively, deploy your API to a Connect instance.

See plumberDeploy/inst at master · meztez/plumberDeploy (github.com) for inspiration.

2 Likes

Thanks a lot. Since I'm not a trained programmer, do you know of a documentation on how to make the API into a service? I did it before with another tool but followed a tutorial for it.

How to create a systemd service in Linux (linuxhandbook.com)

Relevant template : plumberDeploy/plumber.service at master · meztez/plumberDeploy (github.com)

Relevant R used by plumberDeploy : plumberDeploy/digital-ocean.R at master · meztez/plumberDeploy (github.com)

2 Likes

Again! Thanks a lot! Will check it out

Was able to deploy the API to Digital Ocean! Thanks!

Can you help me again and let me know how I can test it now? Can I use Postman for it?

I'm still not sure where I'm going wrong. I succesfully deployed the API but when I go to the url I only get the message "plumber is alive". So if I send a request via postman that is what is rerturned.
Also when I navigate to [[IPADDRESS]]/date/__docs__/ I get a 404. But in the documentation it says I should go there.
Any help would be greatly appreciated. Thank you

Make sure the service you deployed with systemd is actually the plumber API you expect. Check that you are using the right http/https protocol. Check the path you are using make sense. Make sure the endpoint you are using match your API endpoint.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.