Updates records using PATCH (partial) or PUT (destructive). Handles
auto-batching in groups of 10. Also supports upsert via the
upsert_fields argument.
Usage
at_update_records(
base_id,
table_id,
records,
method = c("PATCH", "PUT"),
typecast = FALSE,
upsert_fields = NULL,
token = NULL,
progress = NULL
)Arguments
- base_id
Base ID (e.g.,
"appXXXXXX").- table_id
Table name or ID.
- records
A list of record objects. Each should be a list with
idandfieldselements. For upsert,idcan be omitted.- method
Either
"PATCH"(partial update) or"PUT"(destructive).- typecast
If
TRUE, Airtable will attempt to cast values.- upsert_fields
Character vector (1-3 fields) to merge on for upsert. If
NULL, performs a standard update.- token
Personal access token (resolved via
air_token()ifNULL).- progress
Logical or
NULL. IfTRUE, shows a cli progress bar for batch operations. IfNULL(default), uses optionairtable2.progress.baror env varAIRTABLE2_PROGRESS_BAR(both default toFALSE).
Examples
if (FALSE) { # \dontrun{
# Patch an existing record
at_update_records(
"appXXXXXXXXXXXXXX", "Contacts",
records = list(list(id = "recXXXXXXXXXXXXXX", fields = list(Age = 31)))
)
# Upsert by Name field
at_update_records(
"appXXXXXXXXXXXXXX", "Contacts",
records = list(list(fields = list(Name = "Alice", Age = 31))),
upsert_fields = "Name"
)
} # }