mm_req()
creates a request using httr2::request()
and does
the following:
Inserts the base URL using the environment variable
MEGAMATION_URL
from your .Renviron.Appends the URL with the endpoint defined by parameter
endpoint
.Sets the user-agent as the GitHub megamation package.
Authenticates the request with HTTP basic authentication using environment variables
MEGAMATION_KEY
andMEGAMATION_URL
from your.Renviron
.Handles HTTP errors so useful information from the response is extracted (e.g. "No response body").
Adds caching of responses if available. See
httr2::req_cache()
.
Arguments
- endpoint
The API endpoint. For example,
"timecard"
for employee transactions, and"workorder"
for work orders. All endpoints are listed at https://apidocs.megamation.com/.- ...
<
dynamic-dots
> Name-value pairs to filter the request. The name should be the lower-case name of a field that is filter-enabled (in Megamation's words, a criteria). These arguments are processed withrlang::quos()
and support unquote via!!
and unquote-splice via!!!
.