Create an API call, send the request and retrieve the results, and parse them

full_request(
  ...,
  get_params = list(),
  parse = TRUE,
  clean_dates = TRUE,
  rename = TRUE
)

Arguments

...

values to be passed to appropriate build_x_call function

get_params

list; parameters to be passed to the send_request function (which will pass those parameters to httr::get)

parse

boolean; whether the results should be parsed or returned as a response() object

clean_dates

boolean; whether the csv response columns should be cleaned (reformatted to be correct date/time/datetime)

rename

boolean; whether blank columns should be renamed (not always accurate)

Value

If parse == TRUE, a tibble if service_type = "csv", otherwise a list. If parse == FALSE, a response() object is returned

Examples

# \donttest{ full_request(data_item = "B1730", api_key = "12345", settlement_date = "14-12-2016", parse = TRUE, service_type = "xml")
#> $response #> $response$responseMetadata #> $response$responseMetadata$httpCode #> $response$responseMetadata$httpCode[[1]] #> [1] "403" #> #> #> $response$responseMetadata$errorType #> $response$responseMetadata$errorType[[1]] #> [1] "forbidden" #> #> #> $response$responseMetadata$description #> $response$responseMetadata$description[[1]] #> [1] "An invalid API key has been passed" #> #> #> $response$responseMetadata$queryString #> $response$responseMetadata$queryString[[1]] #> [1] "SettlementDate=2016-12-14" #> #> #> #>
# }