Customizing swagger document on RStudio Connect

Hi,

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 "http://example.com/content/24/mean?samples=5" -H "accept: application/json"

Rather than something like (per Connect docs https://docs.rstudio.com/connect/1.6.6/user/api-keys.html#api-keys-examples)
curl -H 'Authorization: Key YOUR_API_KEY_HERE'
'http://example.com/content/24/mean?samples=5'

Thanks

Iain

@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.