attachment_get | R Documentation |
attachment_get(
sid,
fn,
local_dir = "media",
separate = FALSE,
pid = get_default_pid(),
fid = get_default_fid(),
url = get_default_url(),
un = get_default_un(),
pw = get_default_pw(),
retries = get_retries(),
verbose = get_ru_verbose()
)
sid |
One or many ODK submission UUIDs, an MD5 hash. |
fn |
One or many ODK form attachment filenames, e.g. "1558330537199.jpg". |
local_dir |
The local folder to save the downloaded files to, default: "media". |
separate |
(logical) Whether to separate locally downloaded files into
a subfolder named after the submission uuid within |
pid |
The numeric ID of the project, e.g.: 2. Default: Set default See |
fid |
The alphanumeric form ID, e.g. "build_Spotlighting-0-8_1559885147". Default: Set default See |
url |
The ODK Central base URL without trailing slash. Default: Set default See |
un |
The ODK Central username (an email address).
Default: |
pw |
The ODK Central password.
Default: |
retries |
The number of attempts to retrieve a web resource. This parameter is given to Default: 3. |
verbose |
Whether to display debug messages or not. Read |
This function is the workhorse for
handle_ru_attachments
.
This function is vectorised and can handle either one or many records.
Parameters submission_uuid and attachment_filename accept single or exactly
the same number of multiple values.
The other parameters are automatically repeated.
The media attachments are downloaded into a folder given by local_dir
:
workdir/media/filename1.jpg
workdir/media/filename2.jpg
workdir/media/filename3.jpg
The relative file path for the downloaded attachment(s)
https://docs.getodk.org/central-api-form-management/#downloading-a-form-attachment
https://docs.getodk.org/central-api-submission-management/#downloading-an-attachment
Other utilities:
attachment_link()
,
attachment_url()
,
drop_null_coords()
,
form_schema_parse()
,
get_one_attachment()
,
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()
## Not run:
# See vignette("setup") for setup and authentication options
# ruODK::ru_setup(svc = "....svc", un = "me@email.com", pw = "...")
a_local_dir <- here::here()
# Step 2: Get unparsed submissions
fresh_raw <- odata_submission_get(parse = FALSE)
# Step 3: Get attachment field "my_photo"
fresh_parsed <- fresh_raw %>%
odata_submission_rectangle() %>%
dplyr::mutate(
my_photo = attachment_get(id,
my_photo,
local_dir = a_local_dir,
verbose = TRUE
)
# Repeat for all other attachment fields
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.