related_update {ckanr}R Documentation

Update a related item

Description

Update a related item

Usage

related_update(
  id,
  title,
  type,
  description = NULL,
  related_id = NULL,
  related_url = NULL,
  image_url = NULL,
  url = get_default_url(),
  key = get_default_key(),
  as = "list",
  ...
)

Arguments

id

(character) id of related item to update. This should be an alphanumeric string. Required.

title

(character) Title of the related item. Required.

type

(character) The type of the related item. One of API, application, idea, news article, paper, post or visualization. Required.

description

(character) description (optional). Optional

related_id

(character) An id to assign to the related item. If blank, an ID will be assigned for you. Optional

related_url

(character) A url to associated with the related item. Optional

image_url

(character) A url to associated image. Optional

url

Base url to use. Default: https://data.ontario.ca/ See also ckanr_setup and get_default_url.

key

A privileged CKAN API key, Default: your key set with ckanr_setup

as

(character) One of list (default), table, or json. Parsing with table option uses jsonlite::fromJSON(..., simplifyDataFrame = TRUE), which attempts to parse data to data.frame's when possible, so the result can vary from a vector, list or data.frame. (required)

...

Curl args passed on to verb-POST (optional)

Examples

## Not run: 
# Setup
ckanr_setup(url = "https://demo.ckan.org/", key = getOption("ckan_demo_key"))

# create a package and related item
res <- package_create("hello-saturn2") %>%
   related_create(title = "my resource",
                  type = "visualization")

# update the related item
related_update(res, title = "her resource", type = "idea")

## End(Not run)

[Package ckanr version 0.6.0 Index]