Programmatically schedule a report - not from RStudio Connect page

Dear All,

I am trying to combine rsconnect and connectapi in order to deploy programmatically a product (dashboard, ETL, report, API, etc..) onto RStudio Connect.

Is there a way to programmatically set run-as-user, runtime and/or scheduling from a script?

Best regards,

1 Like

Hi @alessap !

Thanks for sharing this! Do you mind saying a bit more about your use case and why you are trying to deploy this product programmatically to RStudio Connect? We always value learning a bit more about why users are attempting to set up these types of workflows. Is this a CI pipeline?

As for the ways to accomplish this today: there are currently no publicly documented endpoints for setting run as user or the report schedule using the RStudio Connect Server API. Those endpoints have also not yet been exposed to the experimental endpoints within connectapi.

That said, it is possible to view and change the runtime settings for an application using the publicly documented Content API:

In connectapi, this might look like:

creds <- connect()
bnd <- bundle_dir("/path/to/directory")
myapp <- deploy(
  connect = creds, 
  bundle = bnd,
  name = "unique-name",
  title = "The Title",
  access_type = "all",
  load_factor = 0.2,
  max_conns_per_process = 50,
  max_processes = 10,
  min_processes = 2
# if you want to make edits later
  max_conns_per_process = 100
1 Like

Hi @cole,

Thank you very much for your answer and for the code snippet.

Yes, that is correct. We are setting CI and CD pipelines for all our products. The CI focus is on testing, code coverage, linting, deploy new version of the package in our package manager, etc. CD is at this point a script where we deploy the app to RStudio Connect using rsconnect, set vanity URL with connectapi and now what is missing is to set run-as-user, runtime, and scheduling. Hopefully, runtime should be in place using your example.

Best regards,

1 Like

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

This is long-delayed, but I just wanted to follow up and say that all of these options should be available inside of connectapi today! In particular, setting the run-as-user can be done using set_run_as() and scheduling can be accomplished using something like:

content_item(client, "my-guid") %>%
  get_variant_default(myapp) %>%
  get_schedule() %>%

Where set_schedule_*() denotes a handful of helpers designed to assist with setting schedules (set_schedule_day(), set_schedule_week(), etc.)

If you have any more questions on this topic, please feel free to start another thread, as we are happy to keep this conversation going! :smile:

1 Like