Retrieves DNS records from Porkbun for the specified domain
using the
/api/json/v3/dns/retrieve/{domain}
endpoint of Porkbun's
API.
Usage
porkbun_dns_records_get(
domain,
api_key = pal::pkg_config_val("porkbun_api_key"),
secret_api_key = pal::pkg_config_val("porkbun_secret_api_key"),
max_tries = 3L
)
Arguments
- domain
Domain name to retrieve DNS records for. A character scalar.
- api_key
Porkbun API key used for authentication. A character scalar.
- secret_api_key
Porkbun secret API key used for authentication. A character scalar.
- max_tries
Maximum number of attempts to retry in case of an HTTP error. An integerish scalar.
Value
A tibble with the columns id
, type
, hostname
, value
, ttl
, priority
, weight
, port
, flag
, tag
, and target
.
See also
Other Porkbun functions:
porkbun_dns_records_delete()
,
porkbun_dns_records_set()
Examples
if (FALSE) { # \dontrun{
yay::porkbun_dns_records_get(domain = "my.site")
# to write "portable" record keys to a TOML file `dns_records.toml` with a `records` table
# NOTE that the CLI tool `jsontoml` is required for this: https://github.com/pelletier/go-toml/
yay::porkbun_dns_records_get(domain = "my.site") |>
# remove Porkbun-specific cols
dplyr::select(any_of(yay:::cols_dns_records$key)) |>
# convert to target list structure
list(records = _) |>
# convert to JSON
jsonlite::toJSON(auto_unbox = TRUE,
pretty = TRUE) |>
# convert JSON to TOML via external CLI
system2(input = _,
stdout = TRUE,
command = "jsontoml") |>
# remove leading newline
_[-1L] |>
# write TOML to file
brio::write_lines(path = "dns_records.toml")} # }