save: Save data

View source: R/queries.R

saveR Documentation

Save data

Description

Update NAMC database data via the API. Upsert routines are used.

Usage

save(
  api_endpoint,
  args = list(),
  api = .pkgenv$api,
  append_metadata = FALSE,
  ...
)

Arguments

api_endpoint

string A NAMC API endpoint name. Available endpoints can be found via the

args

a list of named arguments to pass to the API endpoint. Can also be passed individually in ... namc_api get_endpoints method.

api

namc_api An instance of the namc_api class having a default of a pre-initialized package object

...

named arguments to merge with data and pass to the API endpoint.

Value

data.frame An identifier of an inserted record OR a data.frame containing the modified record

See Also

info(),browseVignettes("NAMC-API-Overview")

Other query functions: query(), raw_query()

Examples


site = list(
  station = 'myStation',
  lat = 45.555,
  long = -123.555,
  ...
)

sites = NAMCr::save(
  api_endpoint = 'updateSite',
  args = site
)

# Alternative

sites = NAMCr::save(
  api_endpoint = 'updateSite',
  station = 'myStation',
  lat = 45.555,
  long = -123.555
)


namc-utah/NAMCr documentation built on Feb. 12, 2024, 4:29 a.m.