Listing of keys for parametrized report variants in RStudio Connect

I have some questions related to the thread linked above:

(1) Is it possible to get a listing of the keys for the different report variants of a parametrized report?
(2) Is it possible to get a mapping from parameters to the key

The reply in the thread above suggested opening each variant to get the "vanity plus key" combination for a report variant:

The variant with ticker="MSFT" might have the URL /stocks/vhTapsdut/
...
You can find this "vanity plus key" path by visiting any of your variants and then using the "Open Solo" link in the RStudio Connect dashboard.

Is there a batch way to recover the keys if you have many variants.

Thanks

This is a really great use case! So sorry for the delay in getting back to you!! Unfortunately, there is not a great way to accomplish this using the public RStudio Connect Server API today. However, it is possible to accomplish the first item in your query using an experimental R package called connectapi.

The parameters themselves are unfortunately not stored in an accessible location, so there is no real path to retrieve the parameters today :disappointed:

But I personally am very excited about these types of use cases and am looking forward to sharing this with the product team!!

library(connectapi)

client <- connect()

my_content <- content_item(client, "my-item-guid")

get_variants(my_content)

myvar <- get_variant(my_content, "variant-key")

myvar$get_url()

I hope that helps!! Please let us know if you have any feedback on this workflow and what other components of your workflow are challenging that we could help with inside of Connect!

This is just what I need. However, im getting errors.

> library(connectapi)
> 
> client <- connect()
Defining Connect with server: https://rstudio-connect.chop.edu/
> 
> my_content <- content_item(client, "my-item-guid")
List of 3 $ code   : int 3 $ error  : chr "invalid GUID: my-item-guid" $ payload: NULL
Error in self$raise_error(res) : 
  https://rstudio-connect.chop.edu/__api__/v1/experimental/content/my-item-guid request failed with Client error: (400) Bad Request
> 
> get_variants(my_content)
Error in R6::is.R6(instance) : object 'my_content' not found
> 
> myvar <- get_variant(my_content, "variant-key")
Error in R6::is.R6(instance) : object 'my_content' not found
> 
> myvar$get_url()
Error: object 'myvar' not found

I'm glad the example was helpful! "my-item-guid" and "variant-key" are placeholders. You will need to replace them with values that are valid for your environment