R/fct_weather_api.R

Defines functions get_weather

#' Get Weather Data From Tomorrow.io
#'
#' @return 
#' @export
get_weather <- function() {
  
  api_url <- "https://api.tomorrow.io/v4/locations"
  
  ## Make the request to get data from Tomorrow.io
  request <- httr::GET(
    url = api_url
  )
  
  if (request$status != 200) {
    rlang::abort("Request provided returned an invalid status code. Please retry your request!")
  }
  
  weather_content <- request %>% httr::content()
  
  ## This returns no locations because we need to first create a location and provide the coordinates of that location. Then we can query it.
  
}
jasoncareyco95/R-SkyBox documentation built on Dec. 20, 2021, 9:07 p.m.