Delete a record in the database
api_delete.RdA DELETE request is used to remove a record from the database. This function will remove a single record from the database using the record's ID.
Arguments
- api_name
the name of the API to call
- endpoint
the API endpoint to make the request to
- id
The ID of the record to delete.
- dry_run
if TRUE, the call is printed to the console instead of being sent to the API, which is useful for debugging
- verbosity
How much information to print to the console. Defaults to 0.
0: no output
1: show headers
2: show headers and body
3: show headers, body, and curl status messages
- timeout
request timeout in seconds (default is 300)
Value
The httr2 response, which you parse with parse_json2list() or
another parse_*() function, the same as api_get(). With
dry_run = TRUE, the request that would have been sent, as returned by
httr2::req_dry_run().
See also
api_get() to retrieve data, api_post() to create records,
api_patch() to update records
Examples
if (FALSE) { # \dontrun{
api_delete("counts", "projects/age-classes", id = 42) |>
parse_json2list()
# See the request without sending it
api_delete("counts", "projects/age-classes", id = 42, dry_run = TRUE)
} # }