oebb-scotty

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ÖBB Scotty API

ÖBB Scotty API

Query Austria's public transport for trip planning, station departures, and service alerts via the HAFAS mgate API.
通过HAFAS mgate API查询奥地利公共交通的行程规划、车站班次和服务通知。

Quick Reference

快速参考

MethodPurpose
LocMatch
Search for stations/stops by name
TripSearch
Plan a journey between two locations
StationBoard
Get departures/arrivals at a station
HimSearch
Get service alerts and disruptions
Base URL:
https://fahrplan.oebb.at/bin/mgate.exe

方法用途
LocMatch
按名称搜索车站/站点
TripSearch
规划两地之间的行程
StationBoard
获取车站的出发/到达班次
HimSearch
获取服务通知与中断信息
基础URL:
https://fahrplan.oebb.at/bin/mgate.exe

Authentication

身份验证

All requests require these headers in the JSON body:
json
{
  "id": "1",
  "ver": "1.67",
  "lang": "deu",
  "auth": {"type": "AID", "aid": "OWDL4fE4ixNiPBBm"},
  "client": {"id": "OEBB", "type": "WEB", "name": "webapp", "l": "vs_webapp"},
  "formatted": false,
  "svcReqL": [...]
}

所有请求的JSON体中都需要包含以下头部信息:
json
{
  "id": "1",
  "ver": "1.67",
  "lang": "deu",
  "auth": {"type": "AID", "aid": "OWDL4fE4ixNiPBBm"},
  "client": {"id": "OEBB", "type": "WEB", "name": "webapp", "l": "vs_webapp"},
  "formatted": false,
  "svcReqL": [...]
}

1. Location Search (
LocMatch
)

1. 地点搜索(
LocMatch

Search for stations, stops, addresses, or POIs by name.
按名称搜索车站、站点、地址或兴趣点(POI)。

Request

请求示例

bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{"input":{"field":"S","loc":{"name":"Wien Hbf","type":"ALL"},"maxLoc":10}},
      "meth":"LocMatch"
    }]
  }'
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{"input":{"field":"S","loc":{"name":"Wien Hbf","type":"ALL"},"maxLoc":10}},
      "meth":"LocMatch"
    }]
  }'

Response Structure

响应结构

json
{
  "svcResL": [{
    "res": {
      "match": {
        "locL": [{
          "lid": "A=1@O=Wien Hbf (U)@X=16377950@Y=48184986@U=181@L=1290401@",
          "type": "S",
          "name": "Wien Hbf (U)",
          "extId": "1290401",
          "crd": { "x": 16377950, "y": 48184986 },
          "pCls": 6015
        }]
      }
    }
  }]
}
json
{
  "svcResL": [{
    "res": {
      "match": {
        "locL": [{
          "lid": "A=1@O=Wien Hbf (U)@X=16377950@Y=48184986@U=181@L=1290401@",
          "type": "S",
          "name": "Wien Hbf (U)",
          "extId": "1290401",
          "crd": { "x": 16377950, "y": 48184986 },
          "pCls": 6015
        }]
      }
    }
  }]
}

Location Types

地点类型

TypeDescription
S
Station/Stop
A
Address
P
POI (Point of Interest)
类型说明
S
车站/站点
A
地址
P
兴趣点(POI)

Key Fields

关键字段

FieldDescription
lid
Location ID string (use in TripSearch)
extId
External station ID
name
Station name
crd.x/y
Coordinates (x=lon, y=lat, scaled by 10^6)
pCls
Product class bitmask

字段说明
lid
地点ID字符串(用于TripSearch接口)
extId
外部车站ID
name
车站名称
crd.x/y
坐标(x=经度,y=纬度,放大10^6倍)
pCls
产品类别位掩码

2. Trip Search (
TripSearch
)

2. 行程搜索(
TripSearch

Plan a journey between two locations.
规划两地之间的行程。

Request

请求示例

bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "depLocL":[{"lid":"A=1@O=Wien Hbf@L=8103000@","type":"S"}],
        "arrLocL":[{"lid":"A=1@O=Salzburg Hbf@L=8100002@","type":"S"}],
        "jnyFltrL":[{"type":"PROD","mode":"INC","value":"1023"}],
        "getPolyline":false,
        "getPasslist":true,
        "outDate":"20260109",
        "outTime":"080000",
        "outFrwd":true,
        "numF":5
      },
      "meth":"TripSearch"
    }]
  }'
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "depLocL":[{"lid":"A=1@O=Wien Hbf@L=8103000@","type":"S"}],
        "arrLocL":[{"lid":"A=1@O=Salzburg Hbf@L=8100002@","type":"S"}],
        "jnyFltrL":[{"type":"PROD","mode":"INC","value":"1023"}],
        "getPolyline":false,
        "getPasslist":true,
        "outDate":"20260109",
        "outTime":"080000",
        "outFrwd":true,
        "numF":5
      },
      "meth":"TripSearch"
    }]
  }'

Parameters

参数说明

ParamDescription
depLocL
Departure location(s) - use
lid
from LocMatch
arrLocL
Arrival location(s)
outDate
Departure date (YYYYMMDD)
outTime
Departure time (HHMMSS)
outFrwd
true
= search forward,
false
= search backward
numF
Number of connections to return
jnyFltrL
Product filter (see below)
getPasslist
Include intermediate stops
参数说明
depLocL
出发地点 - 使用LocMatch接口返回的
lid
arrLocL
到达地点
outDate
出发日期(YYYYMMDD格式)
outTime
出发时间(HHMMSS格式)
outFrwd
true
=正向搜索,
false
=反向搜索
numF
返回的联运线路数量
jnyFltrL
产品过滤器(见下文)
getPasslist
是否包含中途站点

Product Filter Values

产品过滤器值

BitValueProduct
01ICE/RJX (High-speed)
12IC/EC (InterCity)
24NJ (Night trains)
38D/EN (Express)
416REX/R (Regional Express)
532S-Bahn
664Bus
7128Ferry
8256U-Bahn
9512Tram
Use
1023
for all products, or sum specific bits.
数值产品类型
01ICE/RJX(高速列车)
12IC/EC(城际列车)
24NJ(夜间列车)
38D/EN(特快列车)
416REX/R(区域特快)
532S-Bahn
664巴士
7128渡轮
8256地铁
9512电车
使用
1023
表示所有产品,或累加特定位的数值筛选指定产品。

Response Structure

响应结构

json
{
  "svcResL": [{
    "res": {
      "outConL": [{
        "date": "20260109",
        "dur": "025200",
        "chg": 0,
        "dep": {
          "dTimeS": "075700",
          "dPltfS": {"txt": "8A-B"}
        },
        "arr": {
          "aTimeS": "104900",
          "aPltfS": {"txt": "7"}
        },
        "secL": [{
          "type": "JNY",
          "jny": {
            "prodX": 0,
            "dirTxt": "Salzburg Hbf",
            "stopL": [...]
          }
        }]
      }],
      "common": {
        "locL": [...],
        "prodL": [...]
      }
    }
  }]
}
json
{
  "svcResL": [{
    "res": {
      "outConL": [{
        "date": "20260109",
        "dur": "025200",
        "chg": 0,
        "dep": {
          "dTimeS": "075700",
          "dPltfS": {"txt": "8A-B"}
        },
        "arr": {
          "aTimeS": "104900",
          "aPltfS": {"txt": "7"}
        },
        "secL": [{
          "type": "JNY",
          "jny": {
            "prodX": 0,
            "dirTxt": "Salzburg Hbf",
            "stopL": [...]
          }
        }]
      }],
      "common": {
        "locL": [...],
        "prodL": [...]
      }
    }
  }]
}

Key Connection Fields

联运线路关键字段

FieldDescription
dur
Duration (HHMMSS)
chg
Number of changes
dTimeS
Scheduled departure
dTimeR
Real-time departure (if available)
aTimeS
Scheduled arrival
aTimeR
Real-time arrival (if available)
dPltfS.txt
Departure platform
aPltfS.txt
Arrival platform
secL
Journey sections (legs)
secL[].jny.prodX
Index into
common.prodL[]
for train name
字段说明
dur
行程时长(HHMMSS格式)
chg
换乘次数
dTimeS
计划出发时间
dTimeR
实时出发时间(若可用)
aTimeS
计划到达时间
aTimeR
实时到达时间(若可用)
dPltfS.txt
出发站台
aPltfS.txt
到达站台
secL
行程分段(各段路程)
secL[].jny.prodX
对应
common.prodL[]
数组的索引,用于获取列车名称

Understanding prodX (Product Index)

理解prodX(产品索引)

Important: The
prodX
field in journey sections is an index into the
common.prodL[]
array, NOT the train name itself. To get the actual train name (e.g., "S7", "RJX 662"), you must look up
common.prodL[prodX].name
.
重要提示: 行程分段中的
prodX
字段是
common.prodL[]
数组的索引,而非列车名称本身。要获取实际列车名称(如"S7"、"RJX 662"),需查询
common.prodL[prodX].name

Extracting Trip Summaries with jq

使用jq提取行程摘要

The raw TripSearch response is very verbose. Use this jq filter to extract a concise summary with resolved train names:
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{ ... }' | jq '
    .svcResL[0].res as $r |
    $r.common.prodL as $prods |
    [$r.outConL[] | {
      dep: .dep.dTimeS,
      arr: .arr.aTimeS,
      depPlatform: .dep.dPltfS.txt,
      arrPlatform: .arr.aPltfS.txt,
      dur: .dur,
      chg: .chg,
      legs: [.secL[] | select(.type == "JNY") | {
        train: $prods[.jny.prodX].name,
        dir: .jny.dirTxt,
        dep: .dep.dTimeS,
        arr: .arr.aTimeS,
        depPlatform: .dep.dPltfS.txt,
        arrPlatform: .arr.aPltfS.txt
      }]
    }]'
Example output:
json
[
  {
    "dep": "213900",
    "arr": "221100",
    "depPlatform": "1",
    "arrPlatform": "3A-B",
    "dur": "003200",
    "chg": 0,
    "legs": [{"train": "S 7", "dir": "Flughafen Wien Bahnhof", "dep": "213900", "arr": "221100", ...}]
  }
]

TripSearch接口的原始响应非常冗长。可使用以下jq过滤器提取简洁的行程摘要并解析列车名称:
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{ ... }' | jq '
    .svcResL[0].res as $r |
    $r.common.prodL as $prods |
    [$r.outConL[] | {
      dep: .dep.dTimeS,
      arr: .arr.aTimeS,
      depPlatform: .dep.dPltfS.txt,
      arrPlatform: .arr.aPltfS.txt,
      dur: .dur,
      chg: .chg,
      legs: [.secL[] | select(.type == "JNY") | {
        train: $prods[.jny.prodX].name,
        dir: .jny.dirTxt,
        dep: .dep.dTimeS,
        arr: .arr.aTimeS,
        depPlatform: .dep.dPltfS.txt,
        arrPlatform: .arr.aPltfS.txt
      }]
    }]'
示例输出:
json
[
  {
    "dep": "213900",
    "arr": "221100",
    "depPlatform": "1",
    "arrPlatform": "3A-B",
    "dur": "003200",
    "chg": 0,
    "legs": [{"train": "S 7", "dir": "Flughafen Wien Bahnhof", "dep": "213900", "arr": "221100", ...}]
  }
]

3. Station Board (
StationBoard
)

3. 车站班次看板(
StationBoard

Get departures or arrivals at a station.
获取车站的出发或到达班次。

Request

请求示例

bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "stbLoc":{"lid":"A=1@O=Wien Hbf@L=8103000@","type":"S"},
        "date":"20260109",
        "time":"080000",
        "type":"DEP",
        "maxJny":20
      },
      "meth":"StationBoard"
    }]
  }'
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "stbLoc":{"lid":"A=1@O=Wien Hbf@L=8103000@","type":"S"},
        "date":"20260109",
        "time":"080000",
        "type":"DEP",
        "maxJny":20
      },
      "meth":"StationBoard"
    }]
  }'

Parameters

参数说明

ParamDescription
stbLoc
Station location
date
Date (YYYYMMDD)
time
Time (HHMMSS)
type
DEP
(departures) or
ARR
(arrivals)
maxJny
Maximum number of journeys
参数说明
stbLoc
车站地点
date
日期(YYYYMMDD格式)
time
时间(HHMMSS格式)
type
DEP
(出发班次)或
ARR
(到达班次)
maxJny
返回的最大行程数量

Response Structure

响应结构

json
{
  "svcResL": [{
    "res": {
      "jnyL": [{
        "prodX": 0,
        "dirTxt": "Salzburg Hbf",
        "stbStop": {
          "dTimeS": "080000",
          "dPltfS": {"txt": "8A-B"}
        }
      }],
      "common": {
        "prodL": [{
          "name": "RJX 662",
          "cls": 1,
          "prodCtx": {"catOutL": "Railjet Xpress"}
        }]
      }
    }
  }]
}

json
{
  "svcResL": [{
    "res": {
      "jnyL": [{
        "prodX": 0,
        "dirTxt": "Salzburg Hbf",
        "stbStop": {
          "dTimeS": "080000",
          "dPltfS": {"txt": "8A-B"}
        }
      }],
      "common": {
        "prodL": [{
          "name": "RJX 662",
          "cls": 1,
          "prodCtx": {"catOutL": "Railjet Xpress"}
        }]
      }
    }
  }]
}

4. Service Alerts (
HimSearch
)

4. 服务通知(
HimSearch

Get current disruptions and service information.
获取当前的服务中断和通知信息。

Request

请求示例

bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "himFltrL":[{"type":"PROD","mode":"INC","value":"255"}],
        "maxNum":20
      },
      "meth":"HimSearch"
    }]
  }'
bash
curl -s -X POST "https://fahrplan.oebb.at/bin/mgate.exe" \
  -H "Content-Type: application/json" \
  -d '{
    "id":"1","ver":"1.67","lang":"deu",
    "auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"},
    "client":{"id":"OEBB","type":"WEB","name":"webapp","l":"vs_webapp"},
    "formatted":false,
    "svcReqL":[{
      "req":{
        "himFltrL":[{"type":"PROD","mode":"INC","value":"255"}],
        "maxNum":20
      },
      "meth":"HimSearch"
    }]
  }'

Response Structure

响应结构

json
{
  "svcResL": [{
    "res": {
      "msgL": [{
        "hid": "HIM_FREETEXT_843858",
        "head": "Verringertes Sitzplatzangebot",
        "text": "Wegen einer technischen Störung...",
        "prio": 0,
        "sDate": "20260108",
        "eDate": "20260108"
      }]
    }
  }]
}

json
{
  "svcResL": [{
    "res": {
      "msgL": [{
        "hid": "HIM_FREETEXT_843858",
        "head": "Verringertes Sitzplatzangebot",
        "text": "Wegen einer technischen Störung...",
        "prio": 0,
        "sDate": "20260108",
        "eDate": "20260108"
      }]
    }
  }]
}

Common Station IDs

常用车站ID

StationextId
Wien Hbf8103000
Wien Meidling8100514
Wien Westbahnhof8101003
Salzburg Hbf8100002
Linz Hbf8100013
Graz Hbf8100173
Innsbruck Hbf8100108
Klagenfurt Hbf8100085
St. Pölten Hbf8100008
Wr. Neustadt Hbf8100516

车站extId
维也纳火车总站8103000
维也纳梅德灵站8100514
维也纳西站8101003
萨尔茨堡火车总站8100002
林茨火车总站8100013
格拉茨火车总站8100173
因斯布鲁克火车总站8100108
克拉根福火车总站8100085
圣珀尔滕火车总站8100008
新维也纳火车总站8100516

Time Format

时间格式

  • Dates:
    YYYYMMDD
    (e.g.,
    20260109
    )
  • Times:
    HHMMSS
    (e.g.,
    080000
    = 08:00:00)
  • Duration:
    HHMMSS
    (e.g.,
    025200
    = 2h 52m)

  • 日期:
    YYYYMMDD
    (例如:
    20260109
  • 时间:
    HHMMSS
    (例如:
    080000
    = 08:00:00)
  • 时长:
    HHMMSS
    (例如:
    025200
    = 2小时52分钟)

Error Handling

错误处理

Check
err
field in response:
json
{
  "err": "OK",           // Success
  "err": "PARSE",        // Invalid request format
  "err": "NO_MATCH",     // No results found
  "errTxt": "..."        // Error details
}

检查响应中的
err
字段:
json
{
  "err": "OK",           // 成功
  "err": "PARSE",        // 请求格式无效
  "err": "NO_MATCH",     // 未找到结果
  "errTxt": "..."        // 错误详情
}

Product Classes (cls values)

产品类别(cls值)

clsProduct
1ICE/RJX
2IC/EC
4Night trains
8NJ/EN
16REX/Regional
32S-Bahn
64Bus
128Ferry
256U-Bahn
512Tram
1024On-demand
2048Other
cls值产品类型
1ICE/RJX
2IC/EC
4夜间列车
8NJ/EN
16REX/区域列车
32S-Bahn
64巴士
128渡轮
256地铁
512电车
1024按需服务
2048其他