Swagger UI does not show up when Plumber API is deployed as a service

I have developed a REST API using plumber. When I start the REST API from RStudio using the following command:

plumber::plumb("/PATH/TO/rest-api/scrnaseq-server.R")$run(port = 9000, host = "")

... then I am able to view the Swagger UI at:

However when I deploy the REST API as a service, I am unable to view the Swagger UI at the same URL.

My /etc/systemd/system/plumber-api.service looks like the following:

Description=Plumber API
# After=postgresql
# (or mariadb, mysql, etc if you use a DB with Plumber, otherwise leave this commented)

ExecStart=/usr/bin/Rscript -e "api <- plumber::plumb('/PATH/TO/rest-api/scrnaseq-server.R'); api$run(port=9000, host='')"


Please add swagger = TRUE to the $run method.


plumber::plumb("/PATH/TO/rest-api/scrnaseq-server.R")$run(port = 9000, host = "", swagger = TRUE)

I believe we will be changing the default behavior to always enable swagger in the future. (Not when it is interactive.)

1 Like