Submits get requests to the Harvest API v2 with options configured for authentication, parallelism, and logging

get_table(
  table = NULL,
  user = harvestR::get_harvest_account(),
  key = harvestR::get_harvest_pat(),
  query = NULL,
  plan_options = NULL,
  quiet = T,
  ...,
  auto_retry = lifecycle::deprecated(),
  email = lifecycle::deprecated(),
  verbose = lifecycle::deprecated(),
  strategy = lifecycle::deprecated()
)

Arguments

table

Character table name to be submitted to the Harvest API v2. Refer to Harvest API v2.

user

Character account number (e.g. user = '12345') for authentication. Register at Harvest Developers. Defaults to `get_harvest_account()`

key

Character key (e.g. key = 'Bearer <secret key>') for API authentication. Register at Harvest Developers. Defaults to `get_harvest_pat()`

plan_options

List; list of parameters passed to future::plan. The strategy parameter is required to implement parallel requests, see Future Package Overview for more details.

quiet

Logical; controls harvestR messaging, TRUE returns only errors in the console and FALSE returns messages, warnings, and errors. Does not impact deprecation warnings.

...

Additional arguments forwarded to `httr::RETRY()` and `httr::config()`. Refer to details for more information.

Value

dataframe with contents of requested Harvest table

Details

Maturing lifecycle

Description of ... parameters. Additional arguments are forwarded to config.

  • times integer; Forwarded to RETRY, maximum number of requests to attempt. Defaults to 3.

  • token httr-token; Forwarded to config, an OAuth token (1.0 or 2.0).

References

Harvest API v2 Harvest Developers Page, Future Pacakge Overview, Future Package Output

See also

`future::plan()` for more detail regarding how to implement parallel api calls

`httr::httr_options()` for more detail regarding httr configurations

Examples

if (FALSE) { # Create a credentials record on the system keyring create_harvest_creds() # Set the credentials in the environment for get_table set_harvest_creds() # Barebones call to get_table projects <- get_table(table = 'projects') # Parallel request with 2 retries and messaging # Windows users should use multisession, multicore will not work time_entries <- get_table(table = 'time_entries', query = list(from = '2018-01-01', to = '2018-12-31'), plan_options = list(strategy = "multicore"), times = 2, quiet = F) # Request using an httr option (see `httr::httr_options()`) and an oauth token projects <- get_table(table = 'projects', http_version = 2, token = my_token) }