-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' Download a data source in .tdsx format using Tableau REST API and save it as a file. | ||
#' | ||
#' Downloads a data source in .tdsx format and saves it as a file on your computer. | ||
#' | ||
#' @param tableau A list containing the Tableau authentication variables: `base_url`, `token`, `user_id`, and `site_id`. | ||
#' @param api_version The API version to use (default: 3.16). | ||
#' @param datasource_id The ID of the data source to download. | ||
#' @param file_path The path to save the downloaded data source. | ||
#' @param include_extract Logical indicating whether to include the extract when downloading the data source (default: TRUE). | ||
#' @return A binary vector containing the data source in .tdsx format. | ||
#' @export | ||
#' @family Tableau REST API | ||
download_datasource <- function(tableau, api_version = 3.16, datasource_id, file_path, include_extract = TRUE) { | ||
base_url <- tableau$base_url | ||
token <- tableau$token | ||
site_id <- tableau$site_id | ||
|
||
url <- paste0( | ||
base_url, | ||
"api/", | ||
api_version, | ||
"/sites/", | ||
site_id, | ||
"/datasources/", | ||
datasource_id, | ||
"/content" | ||
) | ||
|
||
if (!include_extract) { | ||
url <- paste0(url, "?includeExtract=False") | ||
} | ||
|
||
api_response <- httr::GET( | ||
url, | ||
httr::add_headers("X-Tableau-Auth" = token), | ||
httr::write_disk(paste0(file_path, "data.tdsx"), overwrite = TRUE) | ||
) | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#' Get mobile security settings for the server using Tableau REST API. | ||
#' | ||
#' Retrieves the mobile security settings for the Tableau Server. | ||
#' | ||
#' @param tableau A list containing the Tableau authentication variables: `base_url`, `token`, `user_id`. | ||
#' @param api_version The API version to use (default: 3.19). | ||
#' @return A list containing the mobile security settings for the server. | ||
#' @export | ||
#' @family Tableau REST API | ||
get_mobile_security_settings <- function(tableau, api_version = 3.19) { | ||
base_url <- tableau$base_url | ||
token <- tableau$token | ||
|
||
url <- paste0( | ||
base_url, | ||
"api/", | ||
api_version, | ||
"/settings/mobilesecuritysettings" | ||
) | ||
|
||
api_response <- httr::GET( | ||
url, | ||
httr::add_headers("X-Tableau-Auth" = token) | ||
) | ||
|
||
jsonResponseText <- httr::content(api_response, as = "text") | ||
|
||
settings <- jsonlite::fromJSON(jsonResponseText) | ||
|
||
return(settings) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.