Skip to contents

mm_data() downloads Megamation tables into R. It automatically

  1. Creates and performs the necessary API GET request(s)

  2. Extracts and combines the data from the API response(s)

  3. Informs when no data is returned or when the API errors

Usage

mm_data(endpoint, ..., allfields = TRUE)

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 with rlang::quos() and support unquote via !! and unquote-splice via !!!.

allfields

If TRUE, return all fields currently available for the endpoint.

Value

A data frame of class tbl_df containing the requested data.

Examples

if (FALSE) { # megamation:::has_creds()
date <- seq.Date(as.Date("2023-01-01"), as.Date("2023-01-03"), by = "day")
mm_data("timecard", date = date)
}