User activity on RSconnect - how to get the app title?

Hello,

I copied the two chunks given here in a Rmd file and I uploaded this file to RSconnect.

The first chunk prints a list:

## [[1]]
## [[1]]$content_guid
## [1] "5440bc91-52c1-489c-8348-81d9836d0083"
## 
## [[1]]$user_guid
## [1] "bd88ea48-f2f8-4eba-877c-f6be6df4d016"
## 
## [[1]]$started
## [1] "2022-08-27T10:06:58Z"
## 
## [[1]]$ended
## [1] "2022-08-27T10:10:24Z"
## 
## [[1]]$data_version
## [1] 1
......

It seems that the given times are the start times and the end times of the connections to our Shiny apps.
Now I'm wondering how to get the title of the Shiny apps?

Since your code returns the content_guid, you can pass it in the GET/v1/content/{guid} endpoint to return the name and title for the specific piece of content (i.e. your shiny app). RStudio documentation can be found here.

Thanks.

I'm a bit lost without an example. Do you mean I should do:

resp <- GET(
  paste0(connectServer, "__api__/v1/content/{the_content_guid}"),
  add_headers(Authorization = paste("Key", connectAPIKey))
)

Yes, based on the documentation, it looks like you should be able to do the following (the code uses your content_guid from above). Either content(resp)$name or content(resp)$title should provide the title of your shiny app.

library(httr)

resp <- GET(
  paste0(connectServer, "__api__/v1/content/5440bc91-52c1-489c-8348-81d9836d0083"),
  add_headers(Authorization = paste("Key", connectAPIKey))
)

content(resp)$name
content(resp)$title

Ah ok, I'm going to try that. So far I tried content(resp)$results and this gives NULL. Thank you for the help.

This works !! Thanks !

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.