nettskjema_get_form_attachments: Retrieve attachments associated with a Nettskjema

View source: R/nettskjema-attachments.R

nettskjema_get_form_attachmentsR Documentation

Retrieve attachments associated with a Nettskjema

Description

Some Nettskjema have fields for attachments. These can be downloaded through this function. There are two naming convention that may be used for the saved files' names. See output of nettskjema_list_attachments for idea of the names used.

Usage

nettskjema_get_form_attachments(
  form_id,
  filenames = c("standardized", "original"),
  output_dir = ".",
  token_name = "NETTSKJEMA_API_TOKEN",
  from_date = "",
  from_submission = "",
  ...
)

Arguments

form_id

integer. Number of the form to retrieve

filenames

string of either 'standardized' (default) or 'original' indicating which file names to use.

output_dir

directory to output the files to

token_name

character. Name to give the token, defaults to 'NETTSKJEMA_API_TOKEN'

from_date

date. From which date on should data be fetched for

from_submission

integer. From which SubmissionId should data be collected from.

...

arguments passed to GET

Details

'filenames types

  • "original" - uses file names are they were uploaded to Nettskjema

  • "standardized" - creates file names based on the submission id and a counter number to uniquely create file names for each submission (in case there are more than one attachment)

Value

invisible named logical if the file was saved successfully

Examples

## Not run: 
form_id <- 1100000
nettskjema_get_form_attachments(form_id)

# save files to specific folder
nettskjema_get_form_attachments(form_id, output_dir = "~/Desktop")

# save using original file names
nettskjema_get_form_attachments(form_id, filenames = "original")


## End(Not run)

LCBC-UiO/nettskjemar documentation built on Aug. 24, 2023, 5:44 p.m.