I can bypass the issue using purrr::map_df with the row index but I am not sure it is a good practice. The API will be linked to a Shiny app, the request should not be too large. Can someone advise me on this point please ?
Since this summer, plumber dev version on github supports parameter of type list. We used the same approach before.
Setting up a default value for dt should provide you with an example on how to setup your json to call your API. I prefer it this way instead of having to define every parameter in the API.
What we use internally is something like that:
library(plumber)
library(xgboost)
model <- readRDS("model.RDS")
sample_dt <- readRDS("sample_dt.RDS")
#* Predict using model
#* @param dt:list
#* @post /predict
function(dt = sample_dt) {
predict(model, new_data = dt)
}