← 开发者工具

实时数据流 (SSE)

GET /stream

连接到 Server-Sent Events 流以获取实时推送更新。订阅广泛主题或使用 topic:filter 语法筛选特定项目。事件包含用于重连的唯一 ID(传递 Last-Event-ID 标头以恢复)。心跳保持连接活跃。使用 curl -N 或 JavaScript EventSource。14 个可用主题:汇率、加密货币、电力、商品、经济、假日、天气、地震、太空天气、NASA、体育、新闻、增值税和货币。

参数

主题 必填

Comma-separated subscriptions with optional filters (e.g. crypto:bitcoin,electricity:NO1)

心跳 可选 默认: 30

Heartbeat interval in seconds (5-300)

请求示例

基本用法
curl -N "https://nordapi.ee/api/v1/stream?topics=crypto:bitcoin,electricity:NO1"
Only Bitcoin price updates
curl -N "https://nordapi.ee/api/v1/stream?topics=crypto:bitcoin"
Only Oslo electricity zone
curl -N "https://nordapi.ee/api/v1/stream?topics=electricity:NO1"
EUR/USD and gold
curl -N "https://nordapi.ee/api/v1/stream?topics=exchange_rates:EUR/USD,commodities:gold"
All Nordic electricity with fast heartbeat
curl -N "https://nordapi.ee/api/v1/stream?topics=electricity&heartbeat=15"
Everything crypto and commodities
curl -N "https://nordapi.ee/api/v1/stream?topics=crypto,commodities"
NOK exchange rates only
curl -N "https://nordapi.ee/api/v1/stream?topics=exchange_rates:NOK"

实时响应

这是一个 Server-Sent Events (SSE) 流式端点。它保持连接打开并实时推送事件。

试试以下命令:
  curl -N "https://nordapi.ee/stream?topics=crypto:bitcoin"