Public plumber api

hi,

I am new to the plumber package, but I would like to host an API posit cloud, which is available publicly.
The example is the one borrowed from the tutorial:

# plumber.R

#* Echo the parameter that was sent in
#* @param msg The message to echo back.
#* @get /echo
function(msg=""){
  list(msg = paste0("The message is: '", msg, "'"))
}

#* Plot out data from the iris dataset
#* @param spec If provided, filter the data to only this species (e.g. 'setosa')
#* @get /plot
#* @serializer png
function(spec){
  myData <- iris
  title <- "All Species"
  
  # Filter if the species was specified
  if (!missing(spec)){
    title <- paste0("Only the '", spec, "' Species")
    myData <- subset(iris, Species == spec)
  }
  
  plot(myData$Sepal.Length, myData$Petal.Length,
       main=title, xlab="Sepal Length", ylab="Petal Length")
}

I have set the hosted API to "All Posit Cloud Users".

Using in the Swagger, it looks to be fine, but if I call it in my local RStudio it results

jsonlite::read_json("https://8be29e0f39fa42c8a97a331c926fa35a.app.posit.cloud/echo?msg=yes")

Error in parse_con(txt, bigint_as_char) :
lexical error: invalid char in json text.
<html lang="en"
(right here) ------^

Isn't it possible to publish an API public with Posit Cloud, or just I make st wrong?
Thanks in advance,
M

Hello,

Unfortunately we do not yet support publicly available published content.

This means that you - or someone that you've shared it with - must be logged into Posit Cloud in order to successfully call the published API's endpoint. It's not working from your local RStudio environment because it is not authenticated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.