-
Notifications
You must be signed in to change notification settings - Fork 12
/
get_attachment.Rd
50 lines (41 loc) · 1.6 KB
/
get_attachment.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_attachment.R
\name{get_attachment}
\alias{get_attachment}
\title{Download attachments and return the local path}
\usage{
get_attachment(data_url, submission_uuid, attachment_filename,
local_dir = "attachments", un = Sys.getenv("ODKC_UN"),
pw = Sys.getenv("ODKC_PW"), verbose = FALSE)
}
\arguments{
\item{data_url}{The ODK Central OData url, including the ".svc"}
\item{submission_uuid}{One or many ODK submission UUIDs, an MD5 hash}
\item{attachment_filename}{One or many ODK form attachment filenames,
e.g. "1558330537199.jpg"}
\item{local_dir}{The local folder to save the downloaded files to,
default: "attachments"}
\item{un}{The ODK Central username (an email address),
default: Sys.getenv("ODKC_UN").
Add to your ~/.Rprofile: Sys.setenv(ODKC_UN="...@...")}
\item{pw}{The ODK Central password,,
default: Sys.getenv("ODKC_PW").
Add to your ~/.Rprofile: Sys.setenv(ODKC_PW="...")}
\item{verbose}{Whether to display debug messages or not (default)}
}
\value{
The relative file path for the downloaded attachment(s)
}
\description{
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.
}
\details{
The media attachments are downloaded into a folder named by the submission's
uuid inside the given `local_dir`. E.g.:
workdir/attachments/uuid:xxxxxxxxxx/filename1.jpg
workdir/attachments/uuid:xxxxxxxxxx/filename2.jpg
workdir/attachments/uuid:xxxxxxxxxx/filename3.jpg
}