R/utils-query.R

Defines functions mnis_query

mnis_query <- function(query) {
  got <- httr::GET(query, httr::accept_json())

  if (httr::http_type(got) != "application/json") {
    stop("API did not return json", call. = FALSE)
  }

  got <- tidy_bom(got)

  got <- jsonlite::fromJSON(got, flatten = TRUE)

  got
}

Try the mnis package in your browser

Any scripts or data that you put into this service are public.

mnis documentation built on April 4, 2021, 1:06 a.m.