Skip to content

DM-Request (Abfahrtsmonitor)

Liefert Abfahrten oder Ankünfte an einer Haltestelle — typische Grundlage für Abfahrts­anzeigen in Apps, Web-Widgets und stationären Displays.

Endpoint

  • Pfad: XML_DM_REQUEST
  • Methode: GET

Obligatorische Parameter

ParameterWerteBeschreibung
modedirectPflicht für die JSON-Schnittstelle
useProxFootSearch0Alternative Haltestellensuche deaktivieren (nötig für eine eindeutige, schnelle Antwort)
Point-Input mit Suffix _dmHaltestelle

Optionale Parameter

ParameterWerteBeschreibung
itdDateTimeDepArrdep (Default) | arr | firstService | lastServiceAbfahrts- oder Ankunftstafel; firstService / lastService ignorieren den Zeit-Parameter
limitGanzzahlMaximale Anzahl an Abfahrten (Default: 40 innerhalb von 2 Tagen)
useRealtime1Echtzeit-Überlagerung aktivieren (fügt u. a. departureTimePlanned, departureTimeEstimated, realtimeStatus hinzu)
Line-Input (line, mehrfach)Abfahrten nach konkreten Linien filtern

Datum & Uhrzeit (itdDate*, itdTime*, timeOffset) sind optional — ohne Angabe gilt „jetzt".

Beispiel-Request

GET /XML_DM_REQUEST
    ?outputFormat=JSON
    &mode=direct
    &useProxFootSearch=0
    &type_dm=any
    &name_dm=de:05911:5494
    &limit=20
    &useRealtime=1

Antwort (Beispiel)

json
{
  "departureList": [
    {
      "servingLine": { "name": "196", "direction": "Essen Kray", "mot": 5 },
      "platform": "1",
      "departureTimePlanned": "2025-01-25T08:22:00Z",
      "departureTimeEstimated": "2025-01-25T08:24:00Z",
      "realtimeStatus": "MONITORED"
    }
  ]
}

JavaScript-Beispiele

js
async function loadDepartures(stopId, { limit = 10, realtime = true } = {}) {
  const base = 'https://server:port/virtuellesVerzeichnis/XML_DM_REQUEST'
  const usp = new URLSearchParams({
    outputFormat: 'JSON',
    mode: 'direct',
    useProxFootSearch: '0',
    type_dm: 'any',
    name_dm: stopId,
    limit: String(limit)
  })
  if (realtime) usp.set('useRealtime', '1')
  const res = await fetch(`${base}?${usp}`)
  if (!res.ok) throw new Error('HTTP ' + res.status)
  return res.json()
}

async function renderDepartures(container, stopId) {
  const data = await loadDepartures(stopId, { limit: 8 })
  container.innerHTML = data.departureList.map(d => `
    <li>
      <strong>${d.servingLine.name}</strong> → ${d.servingLine.direction}
      <span>${new Date(d.departureTimeEstimated ?? d.departureTimePlanned).toLocaleTimeString()}</span>
      <small>Gl. ${d.platform ?? '-'}</small>
    </li>
  `).join('')
}
ts
import { LRUCache } from 'lru-cache'

const cache = new LRUCache<string, unknown>({ max: 100, ttl: 15_000 })
const base = 'https://server:port/virtuellesVerzeichnis/XML_DM_REQUEST'

export async function getDeparturesCached(stopId: string) {
  const cached = cache.get(stopId)
  if (cached) return cached
  const usp = new URLSearchParams({
    outputFormat: 'JSON',
    mode: 'direct',
    useProxFootSearch: '0',
    type_dm: 'any',
    name_dm: stopId,
    limit: '10',
    useRealtime: '1'
  })
  const res = await fetch(`${base}?${usp}`)
  const data = await res.json()
  cache.set(stopId, data)
  return data
}

Hinweise

  • mode=direct und useProxFootSearch=0 sind beide notwendig, damit die Antwort sich exakt auf den angegebenen Halt bezieht.
  • An großen Knoten variiert die Steig-/Gleisangabe. TTL um ~15 s halten, Echtzeit prominent anzeigen.
  • Für reinen Soll-Fahrplan ohne Echtzeit: DMTTP-Request.
  • Fehlerbehandlung: Guide · Error Handling.