TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/adrianaarang/climapp/llms.txt
Use this file to discover all available pages before exploring further.
/api/clima endpoint accepts GPS coordinates and returns a normalized snapshot of current weather conditions from the nearest AEMET observation station. ClimApp performs a two-step fetch internally: first it queries the AEMET metadata API to locate the closest station and retrieve a secondary data URL, then it fetches the actual observation payload from that URL. The raw AEMET fields are mapped to human-readable keys and enriched with an active alerts array before the response is returned to the caller.
Endpoint
Query parameters
GPS latitude of the user’s location, in decimal degrees (e.g.
40.4168).GPS longitude of the user’s location, in decimal degrees (e.g.
-3.7038).Response fields
Name of the nearest AEMET observation station. Mapped from the raw
ubi field in the AEMET payload.Observation timestamp as returned by AEMET. Mapped from the raw
fint field (ISO 8601 format).Air temperature in degrees Celsius (°C). Mapped from the raw
ta field. Defaults to 0 if the field is absent.Relative humidity as a percentage (%). Mapped from the raw
hr field. Defaults to 0 if the field is absent.Wind speed in kilometres per hour (km/h). Mapped from the raw
vv field. Defaults to 0 if the field is absent.Atmospheric pressure in hectopascals (hPa). Mapped from the raw
pres field. Defaults to 0 if the field is absent.Accumulated rainfall in millimetres (mm). Mapped from the raw
prec field. Defaults to 0 if the field is absent.List of active alert labels generated by the internal
AlertService based on the observation values. Examples: ["NARANJA", "VIENTO_FUERTE"]. Returns an empty array when no thresholds are exceeded.Example request
Example response
Error responses
| Status | Condition | Response body |
|---|---|---|
400 | lat or lon query parameter is missing | {"error": "Faltan las coordenadas GPS (lat/lon)"} |
500 | AEMET connection fails or an unexpected error occurs during fetch or normalization | {"error": "<error message>"} |
How the two-step AEMET fetch works
ClimApp uses a two-step fetch for every
/api/clima request. First, WeatherAPIService._obtener_datos_crudos() calls the AEMET observations endpoint. AEMET responds with a metadata object containing a datos URL. A second request to that URL retrieves all current station observations as a JSON array. obtener_clima_por_coordenadas() then iterates this array, computes the Haversine distance for each station, and returns the single observation dict for the nearest station. That dict is passed directly to normalizar_datos_aemet(), which maps AEMET field names to the response fields documented above.