The goal of adaptiveapi is to support access to Workday Adaptive
Planning’s
API
using the {httr2}
and {xml2}
packages.
You can install the development version of adaptiveapi like so:
pak::pkg_install("elipousson/adaptiveapi")
The Adaptive Planning REST API uses XML files as the body of HTTP POST requests.
This package has a helper function req_body_xml()
that takes an
xml_document
object, writes the document to disk, and includes the
file in the POST request. The package also includes helper functions for
creating the request, validating the API
method,
and including the username and password in the XML to authenticate the
request.
However, as of April 2024, this package is a bare-bones experiment that only includes a template for the exportCustomerLogo API method.
library(adaptiveapi)
req <- adaptive_request() |>
adaptive_req_method(
method = "exportCustomerLogo",
username = Sys.getenv("ADAPTIVE_USERNAME"),
password = Sys.getenv("ADAPTIVE_PASSWORD")
)
resp <- httr2::req_perform(req)
resp |>
httr2::resp_body_xml() |>
xml2::as_list()
The username and password should be stored as environmental variables as
illustrated in the example below. The password can be encrypted by using
httr2::secret_make_key()
to generate a key and
httr2::secret_encrypt()
to encrypt the password. The key, username,
and password can be stored as environmental variables with
usethis::edit_r_environ()
.
At present, this package does not include the Adaptive Planning JSON API or any support for using the API with Workday Credentials although the latter feature may be added in the future.