Customizing swagger document on RStudio Connect


Is it possible to customize the curl command that is displayed for a restricted access API that is hosted on Rstudio Connect?

Currently it displays for all APIs, regardless of permissions required
curl -X GET "" -H "accept: application/json"

Rather than something like (per Connect docs
curl -H 'Authorization: Key YOUR_API_KEY_HERE'



@iain this isn't possible today. The reason is because the Swagger docs for Plumber APIs are auto-generated and are unaware of the hosting environment. So, a Plumber API published to RStudio Connect isn't aware that it's published there. User authentication (using the Authorization header) is something handled entirely by RStudio Connect. In fact, that header is stripped before the request ever reaches the Plumber API.

This is a great feature request that has been noted. In order for this to be effectively implemented, there are some changes that would need to happen to the Plumber package to allow for greater flexibility in the Swagger definition.

1 Like

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