I work with the R plumber API. I've created a very simple api that receives an RDS file (a data.frame). On this received rds, I perform a few basic operations and then return this modified data.frame.
With swagger, I can graphically test whether my API is working and it's not. I can't get the RDS file to work. I tried to follow the example here How to send rds file to plumber API using httr package ? but without success
Here below is my code :
library(plumber)
library(dplyr)
library(magrittr)
library(data.table)
#* Get dataframe and create feature
#* @parser multi
#* Add rds parser
#* @parser rds
#* @param df:file
#* @post /dataframe
function(req, res, df) {
str(df)
return(df[,1])
}
I get this error with swagger UI :

Insert a
browser()in there to see why your code is failing:For me, I generated started with
saveRDS(head(mtcars), file="mt.rds"), then uploaded it. From here,So you need to use
df[[1]](or a name if you know it):With that running, I'm able to do this: