webdav_create_request | R Documentation |
This function creates a base request for the WebDAV server with proper authentication. It validates the provided parameters and handles errors during the connection setup.
webdav_create_request(
base_url,
username = Sys.getenv("WEBDAV_USERNAME"),
password = Sys.getenv("WEBDAV_PASSWORD"),
verbose = FALSE
)
base_url |
The base URL of the WebDAV server (e.g., "https://example.com/remote.php/dav/files/"). |
username |
The username for WebDAV authentication. Defaults to the "WEBDAV_USERNAME" environment variable. |
password |
The password for WebDAV authentication. Defaults to the "WEBDAV_PASSWORD" environment variable. |
verbose |
Logical. If TRUE, prints detailed messages during the request creation process. |
An 'httr2_request' object with authentication and base URL configured, or an error message if the connection fails.
# Example usage with a public WebDAV server.
# Visit test_server$url link to view the results of the operation.
library(magrittr)
library(httr2)
test_server <- "https://www.webdavserver.com/" %>%
request() %>%
req_retry(max_tries = 1, max_seconds = 2, backoff = ~ 1) %>%
req_perform() %>%
try(silent = TRUE)
# Create a request
if (class(test_server) != "try-error")
req <- webdav_create_request(base_url = test_server$url, verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.