REST API

La piattaforma Radar-DPC include uno stack di servizi Representational State Transfer (REST), utilizzati nel back end dagli applicativi, ma che rappresenta anche utile API (Applicatio Program Interface) per il download dei dati Radar e più in generale per il lavoro con i servizi esposti da parte di applicazioni di terze parti.

API Endpoints

La API espone due endpoints:

Endpoints

GET /findLastProductByType?type=<PRODUCT>
POST /downloadProduct

Base Url

https://radar-api.protezionecivile.it/

1) GET /findLastProductByType

Restituisce l’ultimo timestamp disponibile per un prodotto, insieme al periodo (ISO-8601) utile per la time-bar.

Query

type=VMI | SRI | SRT1 | IR_108 | TEMP |
CUM3 | CUM6 | CUM12 | CUM24 |
CAPPI_1 | CAPPI_2 | CAPPI_3 | CAPPI_4 |
CAPPI_5 | CAPPI_6 | CAPPI_7 | CAPPI_8 |
CAPPI_9 | CAPPI_10|
VIL | ETM | POH | SITES

Esempio

GET /findLastProductByType?type=VMI

Risposta 200

{
  "total": 1,
  "lastProducts": [{
    "productType": "VMI",
    "time": 1758706200000,
    "period": "PT5M"
  }]
}

404

{"total":0,"lastProducts":[]}

400

{"error":"Missing required query param 'type'."}

2) POST /downloadProduct

Dato un prodotto e un timestamp (epoch ms UTC), restituisce una pre-signed URL S3 per scaricare il file grezzo.

Body (JSON)

{
  "productType": "VMI",
  "productDate": 1758706200000
}

Risposta 200

{
  "bucket": "dpc-radar",
  "key": "VMI/22-09-2025-14-20.tif",
  "url": "https://dpc-radar.s3.eu-south-1.amazonaws.com/VMI/22-09-2025-14-20.tif?...",
  "expiresSeconds": 900
}

404 (file non trovato)

{"error":"File non trovato","bucket":"dpc-radar","key":"VMI/22-09-2025-14-20.tif"}

400 (body mancante/errato)

{"error":"Campo 'productDate' (epoch ms) mancante o non numerico."}

Note

  • Il timestamp viene arrotondato verso il basso al passo del prodotto (5/30/60 minuti).

  • CORS abilitato: POST, OPTIONS, header Content-Type.

Esempi di richieste

Si riportano di seguito alcuni esempi di richieste alla API REST, tramite curl

VMI (5 min)

curl -sS -X POST "https://radar-api.protezionecivile.it/downloadProduct" \
-H "content-type: application/json" \
-d '{"productType":"VMI","productDate":1758541200000}' | jq

TEMP (1 h)

curl -sS -X POST "https://radar-api.protezionecivile.it/downloadProduct" \
-H "content-type: application/json" \
-d '{"productType":"TEMP","productDate":1758537600000}' | jq