Skip to content

Commit

Permalink
feat: update data source now
Browse files Browse the repository at this point in the history
  • Loading branch information
tin900 committed Mar 4, 2024
1 parent 2bbb5a6 commit 019e472
Show file tree
Hide file tree
Showing 42 changed files with 144 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export(query_user_on_site)
export(remove_user_from_group)
export(remove_user_from_site)
export(run_extract_refresh_task)
export(update_data_source_now)
export(update_group)
export(update_user)
importFrom(magrittr,"%>%")
2 changes: 1 addition & 1 deletion R/run_extract_refresh_task.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @export
#'
#' @family Tableau REST API
run_extract_refresh_task <- function(tableau, task_id, api_version = "3.22") {
run_extract_refresh_task <- function(tableau, task_id, api_version = 3.22) {
base_url <- tableau$base_url
token <- tableau$token
site_id <- tableau$site_id
Expand Down
41 changes: 41 additions & 0 deletions R/update_data_source_now.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#' Update Data Source Now
#'
#' Runs an extract refresh on the specified data source.
#'
#' @param tableau A list containing the Tableau authentication variables: `base_url`, `token`, and `site_id`.
#' @param datasource_id The ID of the data source to refresh.
#' @param api_version The API version to use (default: 3.22).
#'
#' @return The response from the API.
#' @export
#'
#' @family Tableau REST API
update_data_source_now <- function(tableau, datasource_id, api_version = 3.22) {
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,
"/refresh"
)

# Construct the request body
# The request body is empty as per the requirements
request_body <- "<tsRequest></tsRequest>"

# Make the POST request to the Tableau REST API
api_response <- httr::POST(
url,
httr::add_headers("X-Tableau-Auth" = token),
body = request_body
)

return(api_response)
}
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ reference:
- download_datasource
- download_tableau_data
- get_server_datasources
- update_data_source_now

- title: Extract and Encryption Methods
desc: Extract and encryption methods for Tableau REST API.
Expand Down
1 change: 1 addition & 0 deletions man/add_tags_to_view.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/add_tags_to_workbook.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/add_user_to_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/add_user_to_site.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/authenticate_PAT.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/authenticate_server.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/create_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/delete_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_datasource.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_filtered_tableau_image.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_tableau_crosstab_excel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_tableau_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_workbooks_server.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_workbooks_server_pdf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/download_workbooks_server_powerpoint.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_groups_for_user.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_mobile_security_settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_connected_apps.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_datasources.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_groups.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_info.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_jobs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_projects.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_refresh_tasks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_schedules.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_user_favorites.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_users.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_views.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_server_workbooks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_table_assets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/get_users_in_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/query_user_on_site.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/remove_user_from_group.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/remove_user_from_site.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/run_extract_refresh_task.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 019e472

Please sign in to comment.