connectapi
connectapi copied to clipboard
Multiple methods of Variant throwing errors
I am hitting errors with the Variant methods that I suspect are due to bug(s).
I have a variant "d":
> d
RStudio Connect Content:
Content GUID: cd3c03ba-38dc-44d1-946f-ec51d011f57d
Content URL: https://rstudio-connect.prod.flatiron.io/connect/#/apps/cd3c03ba-38dc-44d1-946f-ec51d011f57d/
Content Title:
content_item(client, guid = "cd3c03ba-38dc-44d1-946f-ec51d011f57d")
Variant:
get_variant(content, key = 'ECHeGten' )
> class(d)
[1] "Variant" "Content" "R6"
> typeof(d)
[1] "environment"
> str(d)
Classes 'Variant', 'Content', 'R6' <Variant>
Inherits from: <Content>
Public:
add_subscribers: function (guids)
bundle_delete: function (bundle_id)
bundle_download: function (bundle_id, filename = tempfile(pattern = "bundle",
clone: function (deep = FALSE)
connect: Connect, R6
content: list
danger_delete: function ()
deploy: function (bundle_id = NULL)
environment: function ()
environment_all: function (...)
environment_set: function (...)
get_bundles: function ()
get_connect: function ()
get_content: function ()
get_content_remote: function ()
get_dashboard_url: function (pane = "access")
get_job: function (key)
get_jobs: function ()
get_schedule: function ()
get_schedule_remote: function ()
get_subscribers: function ()
get_url: function ()
get_url_rev: function (rev)
get_variant: function ()
get_variant_remote: function ()
initialize: function (connect, content, key)
internal_content: function ()
job: function (key)
jobs: function ()
key: ECHeGten
permissions: function (id = NULL, add_owner = FALSE)
permissions_add: function (principal_guid, principal_type, role)
permissions_delete: function (id)
permissions_update: function (id, principal_guid, principal_type, role)
print: function (...)
remove_subscriber: function (guid)
render: function ()
renderings: function ()
repo_enable: function (enabled = TRUE)
repo_set: function (repository, branch, subdirectory)
runas: function (run_as, run_as_current_user = FALSE)
send_mail: function (to = c("me", "collaborators", "collaborators_viewers"))
tag_delete: function (id)
tag_set: function (tag_id)
tags: function ()
update: function (...)
update_variant: function (...)
variant: list
variants: function ()
I am able to call some methods of d
:
> d$get_variant()
$id
[1] 65
$app_id
[1] 71
$key
[1] "ECHeGten"
$bundle_id
[1] 2033
$is_default
[1] TRUE
$name
[1] "default"
$email_collaborators
[1] TRUE
$email_viewers
[1] FALSE
$email_all
[1] FALSE
$created_time
[1] "2022-06-17T01:59:44.294504Z"
$rendering_id
[1] 17370
$render_time
[1] "2023-02-20T15:19:49.012322Z"
$render_duration
[1] 180978114717
$visibility
[1] "public"
$owner_id
[1] 0
> d$get_schedule()
$id
[1] 76
$app_id
[1] 71
$variant_id
[1] 65
$activate
[1] TRUE
$email
[1] TRUE
$type
[1] "weekday"
$schedule
[1] "{}"
$timezone
[1] "America/New_York"
$start_time
[1] "2022-10-25T10:00:09Z"
$next_run
[1] "2023-02-21T10:00:09Z"
$app_guid
[1] "cd3c03ba-38dc-44d1-946f-ec51d011f57d"
$variant_key
[1] "ECHeGten"
Warning message:
The `get_schedule_remote` function is experimental and subject to change without warning in a future release
This warning is displayed once per session.
However I am unable to call other methods of d
:
> d$get_subscribers()
List of 3 $ code : int 25 $ error : chr "The parameter is invalid." $ payload: NULL
Error in self$raise_error(res) :
https://rstudio-connect.prod.flatiron.io/__api__/variants/{self$get_variant()$id}/subscribers request failed with Client error: (400) Bad Request
> d$add_subscribers(c("06e8a2b2-9e02-4b07-8ba5-b3ce2e9502f5"))
NULL
Error in self$raise_error(res) :
https://rstudio-connect.prod.flatiron.io/__api__/variants/65/subscribers request failed with Server error: (500) Internal Server Error
In addition: Warning message:
The `subscribers` function is experimental and subject to change without warning in a future release
> d$send_mail(to = "me")
List of 3 $ code : int 12 $ error : chr "A required parameter is missing." $ payload: NULL
Error in self$raise_error(res) :
https://rstudio-connect.prod.flatiron.io/__api__/variants/65/sender request failed with Client error: (400) Bad Request
Session info:
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] httr_1.4.2 connectapi_0.1.2 rsconnect_0.8.25 fs_1.5.2
[5] stringr_1.4.0 lubridate_1.8.0 glue_1.6.2 flatironconnect_0.6.0
[9] dplyr_1.0.8 dbplyr_2.1.1 assertthat_0.2.1 yaml_2.3.5
[13] purrr_0.3.4 magrittr_2.0.2
loaded via a namespace (and not attached):
[1] bslib_0.3.1 jquerylib_0.1.4 pillar_1.7.0 compiler_4.1.2 tools_4.1.2
[6] bit_4.0.4 digest_0.6.29 packrat_0.7.0 uuid_1.0-3 jsonlite_1.8.0
[11] evaluate_0.15 lifecycle_1.0.1 tibble_3.1.6 pkgconfig_2.0.3 rlang_1.0.2
[16] rstudioapi_0.13 DBI_1.1.2 cli_3.2.0 curl_4.3.2 xfun_0.30
[21] fastmap_1.1.0 knitr_1.37 sass_0.4.0 generics_0.1.2 vctrs_0.4.0
[26] bit64_4.0.5 tidyselect_1.1.2 R6_2.5.1 fansi_1.0.2 ellipsis_0.3.2
[31] htmltools_0.5.2 usethis_2.1.5 mime_0.12 renv_0.15.0 utf8_1.2.2
[36] stringi_1.7.6 crayon_1.5.0
Thanks for reporting this!! It has been a while since I poked at this part of the code base, so it may take me a bit to get back up to speed, but this definitely seems like it should be improved 😄