R/download_coastal_site_parameters.R

Defines functions download_coastal_site_parameters

Documented in download_coastal_site_parameters

#' Download 'TWDB' Coastal Station Parameters
#'
#' @param station character, required.
#'
#' @return tibble
#' @export
#'
download_coastal_site_parameters <- function(station) {
  if(!is.character(station)) {
    stop("'station' must be a character object")
  }

  url <- sprintf("https://waterdatafortexas.org/coastal/api/stations/%s/parameters",
                 station)
  path <- NULL
  ## download
  content <- get_download(url, path, accept = "json")

  ## parse the returned json
  content <- jsonlite::fromJSON(content)

  ## return as tibble
  content <- tibble::as_tibble(content)

  return(content)

}
mps9506/wd4tx documentation built on Feb. 11, 2022, 11:33 p.m.