entitylist_update: Update Entity List details.

View source: R/entitylist_update.R

entitylist_updateR Documentation

Update Entity List details.

Description

[Maturing]

Usage

entitylist_update(
  pid = get_default_pid(),
  did = NULL,
  approval_required = FALSE,
  url = get_default_url(),
  un = get_default_un(),
  pw = get_default_pw(),
  retries = get_retries(),
  odkc_version = get_default_odkc_version(),
  orders = c("YmdHMS", "YmdHMSz", "Ymd HMS", "Ymd HMSz", "Ymd", "ymd"),
  tz = get_default_tz()
)

Arguments

pid

The numeric ID of the project, e.g.: 2.

Default: get_default_pid.

Set default pid through ru_setup(pid="...").

See vignette("Setup", package = "ruODK").

did

(chr) The name of the Entity List, internally called Dataset.

approval_required

(lgl) The value to set approvalRequired to. If TRUE, a submission must be approved before an entity is created, if FALSE, an entity is created as soon as the submission is received by ODK Central. Default: FALSE.

url

The ODK Central base URL without trailing slash.

Default: get_default_url.

Set default url through ru_setup(url="...").

See vignette("Setup", package = "ruODK").

un

The ODK Central username (an email address). Default: get_default_un. Set default un through ru_setup(un="..."). See vignette("Setup", package = "ruODK").

pw

The ODK Central password. Default: get_default_pw. Set default pw through ru_setup(pw="..."). See vignette("Setup", package = "ruODK").

retries

The number of attempts to retrieve a web resource.

This parameter is given to RETRY(times = retries).

Default: 3.

odkc_version

The ODK Central version as a semantic version string (year.minor.patch), e.g. "2023.5.1". The version is shown on ODK Central's version page ⁠/version.txt⁠. Discard the "v". ruODK uses this parameter to adjust for breaking changes in ODK Central.

Default: get_default_odkc_version or "2023.5.1" if unset.

Set default get_default_odkc_version through ru_setup(odkc_version="2023.5.1").

See vignette("Setup", package = "ruODK").

orders

(vector of character) Orders of datetime elements for lubridate.

Default: c("YmdHMS", "YmdHMSz", "Ymd HMS", "Ymd HMSz", "Ymd", "ymd").

tz

A timezone to convert dates and times to.

Read vignette("setup", package = "ruODK") to learn how ruODK's timezone can be set globally or per function.

Details

You can only update approvalRequired using this endpoint. The approvalRequired flag controls the Entity creation flow; if it is true then the Submission must be approved before an Entity can be created from it and if it is false then an Entity is created as soon as the Submission is received by the ODK Central. By default approvalRequired is false for the Entity Lists created after v2023.3. Entity Lists created prior to that will have approvalRequired set to true.

An Entity List is a named collection of Entities that have the same properties. An Entity List can be linked to Forms as Attachments. This will make it available to clients as an automatically-updating CSV.

This function is supported from ODK Central v2022.3 and will warn if the given odkc_version is lower.

[Maturing]

Value

A list of lists following the exact format and naming of the API response for entitylist_detail. Since this nested list is so deeply nested and irregularly shaped it is not trivial to rectangle the result into a tibble.

See Also

https://docs.getodk.org/central-api-dataset-management/#datasets

Examples

## Not run: 
# See vignette("setup") for setup and authentication options
# ruODK::ru_setup(svc = "....svc", un = "me@email.com", pw = "...")

pid <- get_default_pid()

ds <- entitylist_list(pid = pid)

did <- ds$name[1]

ds1 <- entitylist_detail(pid = pid, did = did)
ds1$approvalRequired # FALSE

ds2 <- entitylist_update(pid = pid, did = did, approval_required = TRUE)
ds2$approvalRequired # TRUE

ds3 <- entitylist_update(pid = pid, did = did, approval_required = FALSE)
ds3$approvalRequired # FALSE

## End(Not run)

dbca-wa/ruODK documentation built on March 20, 2024, 12:19 p.m.