upload_survey_media: Upload a tibble of SurveyMediaAttachments to WAStD

View source: R/upload_survey_media.R

upload_survey_mediaR Documentation

Upload a tibble of SurveyMediaAttachments to WAStD

Description

Upload a tibble of SurveyMediaAttachments to WAStD

Usage

upload_survey_media(
  x,
  api_url = wastdr::get_wastdr_api_url(),
  api_token = wastdr::get_wastdr_api_token(),
  verbose = wastdr::get_wastdr_verbose(),
  upload = Sys.getenv("ODKC_IMPORT_UPLOAD_MEDIA", unset = TRUE)
)

Arguments

x

A tibble of SurveyMediaAttachments, e.g. the output of odkc_as_survey_media(). Note that media files should be relative or absolute file paths, not httr::upload_file() objects.

api_url

(character) The WAStD API URL, default get_wastdr_api_url, see wastdr_setup

api_token

(character) The WAStD API token, default get_wastdr_api_token, see wastdr_setup

verbose

Whether to show debug messages. Default: wastdr::get_wastdr_verbose()

upload

Whether to upload media files. Default: Sys.getenv("ODKC_IMPORT_UPLOAD_MEDIA", unset=TRUE)

api_un

(character) A WAStD API username, default get_wastdr_api_un, see wastdr_setup

api_pw

(character) A WAStD API password, default get_wastdr_api_pw, see wastdr_setup

Details

WAStD's SurveyMediaAttachment endpoint uses a plain ModelViewSet and cannot handle multiple uploads. This function therefore uploads records individually. If a file does not exist locally, the record is skipped and a warning is emitted.


dbca-wa/etlTurtleNesting documentation built on Nov. 18, 2022, 8:03 a.m.