Usage
get_one_attachment(
pth,
fn,
src,
url = get_default_url(),
un = get_default_un(),
pw = get_default_pw(),
retries = get_retries(),
verbose = get_ru_verbose()
)
Arguments
- pth
A local file path to save the attachment to.
- fn
The attachment filename, as per ODK form submission. If NA, no file will be downloaded, but NA will be returned. If the file does not exist in ODK Central, a warning will be emitted.
- src
The attachment's download URL, generated by
attachment_url
. The src must contain theuuid:
prefix. Note that the main Submissions table contains the submission id in the fieldid
, whereas nested sub-tables contain the submission id in the fieldsubmissions_id
.- url
The ODK Central base URL without trailing slash.
Default:
get_default_url
.Set default
url
throughru_setup(url="...")
.See
vignette("Setup", package = "ruODK")
.- un
The ODK Central username (an email address). Default:
get_default_un
. Set defaultun
throughru_setup(un="...")
. Seevignette("Setup", package = "ruODK")
.- pw
The ODK Central password. Default:
get_default_pw
. Set defaultpw
throughru_setup(pw="...")
. Seevignette("Setup", package = "ruODK")
.- retries
The number of attempts to retrieve a web resource.
This parameter is given to
RETRY(times = retries)
.Default: 3.
- verbose
Whether to display debug messages or not.
Read
vignette("setup", package = "ruODK")
to learn howruODK
's verbosity can be set globally or per function.
Details
This is a helper function used by attachment_get
.
This function is not vectorised, but mapped by attachment_get
to a tibble of input parameters.
See also
Other utilities:
attachment_get()
,
attachment_link()
,
attachment_url()
,
drop_null_coords()
,
form_schema_parse()
,
get_one_submission()
,
get_one_submission_att_list()
,
get_one_submission_audit()
,
handle_ru_attachments()
,
handle_ru_datetimes()
,
handle_ru_geopoints()
,
handle_ru_geoshapes()
,
handle_ru_geotraces()
,
isodt_to_local()
,
odata_submission_rectangle()
,
predict_ruodk_name()
,
prepend_uuid()
,
split_geopoint()
,
split_geoshape()
,
split_geotrace()
,
strip_uuid()
,
tidyeval
,
unnest_all()
Examples
if (FALSE) { # \dontrun{
# Step 1: Setup ruODK with OData Service URL (has url, pid, fid)
# See vignette("setup") for setup and authentication options
# ruODK::ru_setup(svc = "....svc", un = "me@email.com", pw = "...")
# Step 2: Construct attachment_url
att_url <- ruODK:::attachment_url(
"uuid:d3bcefea-32a8-4dbc-80ca-4ecb0678e2b0",
"filename.jpg"
)
# Step 3: Get one attachment
local_fn <- get_one_attachment("media/filename.jpg", "filename.jpg", att_url)
# In real life: done in bulk behind the scenes during odata_submission_get()
} # }