Can I use javascript or the RStudio Connect API to get the URL of the current page in Rmarkdown

November 26, 2019 @FvD Frans van Dunné

@FvD wrote:

In brief: We are trying to do the following, with the aim to include a (variable) link to a parameterized Rmarkdown report in an email generated in RStudio Connect.

In connect each time that we create a new version of a Parameterized report and save it, connect creates a sub-id. The url will be something like /connect/#/apps/102/access/55 where 102 is the id of the original report and 55 of the sub-report that we have saved with different variables. The id 102 does not change when we create a new version of the report. But the sub-id does, and is different with every new parameterized version that we save.

What we would like to do is to send an email based on the parameterized version (in this case with sub id 55), but not including the full report, but with a button that brings the user to the report if they decide to read it.

Including the button is not the issue. The issue is including the correct URL. Since the email is defined in the main Rmarkdown file (published with id 102), we need to identify the current url (with sub id, in this case 55) on a case by case basis.

We have tried to get the URL using the Connect API, but cannot get details of the sub-pages when we us the get_content endpoint. For instance.


So we tried to include javascript, for instance

var jstest = window.location;

This may be the most promising path, but how do we get the output of window.location back a follow up R chunk in the Rmarkdown file?

Has you solved this use case somehow? Or could you give us a pointer to look for a solution?

Posts: 3

Participants: 3

Read full topic

Previous Article
Find job id or application name from process id
Find job id or application name from process id

@GeeGee wrote: I would like to understand list of applications with high CPU and...

Next Article
SAML 2.0 With Shiny Server Pro
SAML 2.0 With Shiny Server Pro

@chetanm wrote: SAML 2.0 seems to be added for R studio connect ( https://blog....