get_data_aemet: Client tool for the AEMET API

View source: R/aemet-api-query.R

get_data_aemetR Documentation

Client tool for the AEMET API

Description

Client tool to retrieve data and metadata from AEMET and convert JSON to a tibble.

Usage

get_data_aemet(apidest, verbose = FALSE)

get_metadata_aemet(apidest, verbose = FALSE)

Arguments

apidest

Character string with a destination URL. See https://opendata.aemet.es/dist/index.html.

verbose

Logical. If TRUE, provides information about the flow of information between the client and server.

Value

A tibble (if possible) or the results of the query as provided by httr2::resp_body_raw() or httr2::resp_body_string().

Source

https://opendata.aemet.es/dist/index.html.

See Also

See examples of how to use these functions in vignette("extending-climaemet").

Examples


# Run this example only if AEMET_API_KEY is detected.

url <- "/api/valores/climatologicos/inventarioestaciones/todasestaciones"

get_data_aemet(url)

# Metadata

get_metadata_aemet(url)

# Get data from any API endpoint.

# Plain text

plain <- get_data_aemet("/api/prediccion/nacional/hoy")

cat(plain)

# An image

image <- get_data_aemet("/api/mapasygraficos/analisis")

# Write and read.
tmp <- tempfile(fileext = ".gif")

writeBin(image, tmp)

gganimate::gif_file(tmp)


climaemet documentation built on June 3, 2026, 5:07 p.m.