R/group_delete.R

Defines functions group_delete

Documented in group_delete

#' Delete a group
#'
#' @export
#' @param id (character) The id of the group. Required.
#' @param url Base url to use. Default: https://data.ontario.ca
#' See also [ckanr_setup()] and [get_default_url()]
#' @param ... Curl args passed on to [crul::verb-POST] (optional)
#' @template key
#'
#' @examples \dontrun{
#' # Setup
#' ckanr_setup(url = "https://demo.ckan.org", key = getOption("ckan_demo_key"))
#'
#' # create a group
#' (res <- group_create("lions", description="A group about lions"))
#'
#' # show the group
#' group_show(res$id)
#'
#' # delete the group
#' group_delete(res)
#' ## or with it's id
#' # group_delete(res$id)
#' }
group_delete <- function(id, url = get_default_url(), key = get_default_key(),
  ...) {

  id <- as.ckan_group(id, url = url)
  tmp <- ckan_POST(url, 'group_delete', body = list(id = id$id), key = key,
    opts = list(...))
  jsonlite::fromJSON(tmp)$success
}

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.