Questions tagged [plumber]

plumber is an R package used to create HTTP APIs from R. It uses annotations above your function definitions to define the structure of your API using existing R code.

The plumber R package allows R users to create HTTP APIs from their R code.

  • Official documentation - Includes documentation about the various features and online examples.
  • CRAN - The package is available on CRAN for easier installation.
307 questions
5
votes
1 answer

Get file through API call (R & plumber)

I'm using plumber as a simple web-api service for some R functions. I would like to provide a file 'download' (on the client side) through an R function very much like flask is doing it in python through send_file and send_from_directory. I tried #*…
Drey
  • 3,314
  • 2
  • 21
  • 26
5
votes
2 answers

How to send json response using plumber R

I need to send response from R using plumber package in below format { "status": "SUCCESS", "code": "200", "output": { "studentid": "1001", "name": "Kevin" } } But I am getting below format [ "{\n \"status\": \"SUCCESS\",\n …
5
votes
1 answer

serving static files with plumber package - files not found (404)

I want to serve a static file with plumber as described here. The file with the routes etc. is server.R: #* @get /files function() { return(dir("files")) } #* @static ./files list() This should make the files directory available on the path…
Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88
4
votes
1 answer

Add header authentication to the swagger UI in R plumber

I have created a plumber API in R that authenticates user requests via a bearer token in the header. The code for the authentication is a filter that looks like this: #* @filter checkAuthentication function(req, res) { if (!req$PATH_INFO %in%…
Fnguyen
  • 1,159
  • 10
  • 23
4
votes
1 answer

Why does deploying a tidymodel with vetiver throw a error when there's a variable with role as ID?

I'm unable to deploy a tidymodel with vetiver and get a prediction when the model includes a variable with role as ID in the recipe. See the following error in the image: { "error": "500 - Internal server error", "message": "Error: The following…
4
votes
1 answer

Is it possible to separate each endpoint into its own file in R Plumber?

Im looking to separate out my complex API structure so that I have the following structure. I am wondering. Is there a way to mount all files under the users/ folder to the same ./api/v1/users route? And the same for projects/ ? One key point of…
BejanSadeghian
  • 609
  • 1
  • 6
  • 10
4
votes
1 answer

Upload multiple file through plumber API in R

I am Developing REST API using Plumber in R. In which I have a module where I was support to upload multiple CEL file and runs the algorithms, get the output and show it in the front-end. I had refer this code but I am confused Is this code is…
4
votes
0 answers

R plumber api works in console, but not with systemd

I have a weather station that sends data out periodically and want to make an API with plumber to receive and save the JSON data. My script is # plumber.R library(tidyverse) library(lubridate) #' @post /station #' @serializer json #' @param…
pgcudahy
  • 1,542
  • 13
  • 36
4
votes
3 answers

How to stop plumber server

I have created a server using plumber How do I stop the server? "my approach -: once i get to know that , i will put a command , if we press a key then it will stop" thanks in advance
jony
  • 924
  • 10
  • 25
4
votes
2 answers

Coerce arguments to simplest type

When dealing with user input using packages shiny or plumber one often needs to convert character arguments to numeric or logical. I would like to do it automatically, what's an efficient way to do it ? expected (this or similar) : convert_args <-…
moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
4
votes
1 answer

How to distribute a plumber API over several file using mounts?

I am dealing with a large API and I'd like to distribute its definition over several file. As far as I understood, reading the documentation this where the "mounnt()" method from a plumb comes to play I have tried the following: iris.R: #* Return a…
Ylan
  • 69
  • 4
4
votes
2 answers

R Script running successfully on local machine, not on EC2 instance

I have an R script (an R plumber API) that I have deployed to an EC2 instance and managing with pm2, and I am running into a struggling issue. I have pinpointed the exact location of the error, and am hoping to understand this error a bit…
Canovice
  • 9,012
  • 22
  • 93
  • 211
4
votes
1 answer

Using plumber to read json as input value of API function

I have a function that takes in a character vector as argument and after processing returns a result. I want to expose it as an API using plumber. How to I pass a JSON as input I have used the following code file_recommender =…
NinjaR
  • 621
  • 6
  • 22
4
votes
1 answer

Sending json file in curl and receiving it in R using plumber

I need to send a json file with multiple values and receive it in R using plumber, ive tried this but it doesnt seem to work, library("rjson") #install.packages("rjson") #* @get /predict #* @post /predict function(predict) { # Load the package…
Aditya
  • 55
  • 1
  • 7
4
votes
1 answer

Recoding RShiny app into React App - how to get my data to my React App

I am learning full stack development for a basketball-related data viz web app that I want / am trying to make. I have a question relating to the best approach for solving a data problem of mine, given what tech skills I have. A few months ago I…
Canovice
  • 9,012
  • 22
  • 93
  • 211
1
2
3
20 21