-
Notifications
You must be signed in to change notification settings - Fork 0
API
Willi Raschkowski edited this page Sep 17, 2016
·
19 revisions
For anything to work, you need an access token. Ask one of the helpers, they'll give you one. The base url for all requests is
So if you see a request url below, something like /openapi/vbb-proxy/location.name?...
, think http://demo.hafas.de/openapi/vbb-proxy/location.name?...
.
Say you want a list of stops for a query 'rosenthaler'. This is how you get it:
/openapi/vbb-proxy/location.name? // 'location.name' is the name of the service
input=rosenthaler& // 'rosenthaler' is your input
format=json& // this sets the format to 'json' (as opposed to xml)
accessId=ACCESS_TOKEN& // put the access token here
type=S // use 'S' to search for stations only
What you get is a JS object as a json file. It contains a property called stopLocationOrCoordLocation whose value is an array that contains the stations.
{
"stopLocationOrCoordLocation": [
{
"StopLocation": {
"LocationNotes": {
"LocationNote": [
{ "value": "Aufzug", "key": "AT", "type": "A" },
{ "value": "Blindenleitstreifen", "key": "BL", "type": "A" },
{ "value": "Fahrt für Touch&Travel zugelassen", "key": "TT", "type": "A" }
]
},
"id": "A=1@O=U Rosenthaler Platz (Berlin)@X=13401397@Y=52529778@U=86@L=009100023@B=1@V=3.9,@p=1474013583@",
"extId": "009100023",
"name": "U Rosenthaler Platz (Berlin)",
"lon": 13.401397,
"lat": 52.529778,
"weight": 13290,
"products": 14
}
},
{
"StopLocation": {
"LocationNotes": {
"LocationNote": [
{ "value": "Fahrt für Touch&Travel zugelassen", "key": "TT", "type": "A" }
]
},
"id": "A=1@O=Rosenthaler Str. (Berlin)@X=13433093@Y=52595857@U=86@L=009134501@B=1@V=3.9,@p=1474013583@",
"extId": "009134501",
"name": "Rosenthaler Str. (Berlin)",
"lon": 13.433093,
"lat": 52.595857,
"weight": 1872,
"products": 12
}
},
"..."
],
"serverVersion": "1.7-SNAPSHOT",
"dialectVersion": "1.23"
}