R/ping.R

Defines functions ping

Documented in ping

#' Ping a CKAN server to test that it's up or down.
#'
#' @export
#'
#' @template args
#' @template key
#' @examples \dontrun{
#' ping()
#' ping(as = "json")
#' }
ping <- function(url = get_default_url(), key = get_default_key(),
  as = "logical", ...) {
  
  tryCatch({
    res <- ckan_GET(url, 'site_read', key = key, opts = list(...))
    switch(as, json = res, logical = jsd(res))
  }, error = function(e) FALSE)
}

Try the ckanr package in your browser

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

ckanr documentation built on March 31, 2023, 6:54 p.m.