R/update_dataset.R

Defines functions update_dataset

Documented in update_dataset

#' update_dataset
#'
#' Update existing in DDH
#'
#' @param nid character: Node ID of the dataset to be updated
#' @param body json: json object generated by jsonlite::toJSON
#' @param root_url character: API root URL
#' @param credentials list: authentication token and cookie
#'
#'
#' @return list
#' @export
#'

update_dataset <- function(nid,
                           body,
                           root_url = dkanr::get_url(),
                           credentials = list(cookie = dkanr::get_cookie(),
                                              token = dkanr::get_token())) {
  out <- dkanr::update_node(nid = nid,
                            url = root_url,
                            body = body,
                            credentials = credentials)
  return(jsonlite::fromJSON(out))
}
tonyfujs/ddhconnect documentation built on June 3, 2020, 10:33 a.m.