My plumber api works fine when using a single value for a query parameter (e.g. 'in_subject' = A). However, when I add an additional value, separated by '&' , I get nothing (see fig). I'm pretty sure adding '&' between items in a list previously worked. Any help greatly appreciated!
library(plumber)
library(dplyr)
subject <- c("A", "B", "C", "D", "E")
age <- c(23, 41, 32, 58, 26)
df <- data.frame(subject, age)
#* @apiTitle repro
#* Returns Data in JSON format
#* @param in_subject
#* @get /S
function(in_subject) {
df %>%
filter(
subject == in_subject
The ampersand gets encoded and is not part of the URL since you are using it within a Swagger input. To use multiple inputs, define your parameter as an array by encloding the type within square brackets.
library(plumber)
library(dplyr)
subject <- c("A", "B", "C", "D", "E")
age <- c(23, 41, 32, 58, 26)
df <- data.frame(subject, age)
#* @apiTitle repro
#* Returns Data in JSON format
#* @param in_subject:[string]
#* @get /S
function(in_subject) {
df %>%
filter(
subject == in_subject