Coder Social home page Coder Social logo

derhuerst / vbb-rest Goto Github PK

View Code? Open in Web Editor NEW
123.0 5.0 14.0 338 KB

An HTTP API for Berlin & Brandenburg public transport.

Home Page: https://v6.vbb.transport.rest/

License: ISC License

JavaScript 97.58% Dockerfile 2.42%
transport vbb bvg berlin api transit

vbb-rest's Introduction

vbb-rest

vbb-rest is a public transport REST API, a clean alternative to the VBB HAFAS API.

API documentation

vbb-rest architecture diagram

API status ISC-licensed support me via GitHub Sponsors chat with me on Twitter

installing & running

access to Redis

It is recommended that you let bvg-rest cache HAFAS responses within a Redis cache. To use this feature, set $REDIS_URL (e.g. to redis://localhost:6379/1 when running Redis locally).

via Docker

A Docker image is available as derhuerst/vbb-rest:6.

docker run -d -p 3000:3000 derhuerst/vbb-rest:6

Note: The Docker image does not contain the Redis server.

manually

git clone https://github.com/derhuerst/vbb-rest.git
cd vbb-rest
git checkout 6
npm install

export HOSTNAME='my-vbb-rest-api.example.org'
npm run build

redis-server &
npm start

To keep the API running permanently, use tools like forever or systemd.

Related Projects

  • vbb-modules – List of JavaScript modules for Berlin & Brandenburg public transport.
  • vbb-hafas – JavaScript client for the BVG HAFAS API.
  • bvg-rest – A clean REST API wrapping around the BVG API.
  • db-rest – A clean REST API wrapping around the Deutsche Bahn API.
  • hvv-rest – A clean REST API wrapping around the HVV API.
  • hafas-rest-api – Expose a HAFAS client via an HTTP REST API.
  • hafas-client – JavaScript client for HAFAS public transport APIs.

Contributing

If you have a question or have difficulties using vbb-rest, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

vbb-rest's People

Contributors

derhuerst avatar heyarne avatar sophiamersmann avatar zorapeteri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vbb-rest's Issues

stations/query does not return any stations

When I try to query a station by the name, the API always returns an empty response.

To reproduce (the example in the documentation):

curl 'https://v5.vbb.transport.rest/stations?query=mehringd' -s | jq

Best regards
Daniel

bug

U3 is being listed under U Möckernbrücke

https://transport.rest/stations/900000017104
{
    "id": "900000017104",
    "name": "U Möckernbrücke",
    "latitude": 52.498944,
    "longitude": 13.383256,
    "weight": 7281.5,
    "lines": [
        {
            "id": "17466_700",
            "name": "N1",
            "type": "bus"
        },
        {
            "id": "17512_400",
            "name": "U1",
            "type": "subway"
        },
        {
            "id": "17515_400",
            "name": "U3",
            "type": "subway"
        },
        {
            "id": "17523_400",
            "name": "U7",
            "type": "subway"
        }
    ]
}

"Stations connected to" endpoint?

Hey there,

Thanks so much for all the incredibly useful VBB libraries, and especially for running this REST API!

I wondered if you'd be interested in this API having an endpoint exposing the data in vbb-stations-connected-to – maybe at GET /stations/:id/connected-stations or similar.

I'm using the connected stations data in a single-page app and at the moment my only options are to 1. include the huge blob of data as JavaScript (very large, makes my app > 1 MB) or 2. run my own API exposing only this data, and have my app make requests to two different APIs.

I'd be up for doing the implementation if you don't have time. I just wanted to check here before doing any work on it. Maybe there are design/performance reasons why you don't want to do this, I'm not sure.

update of doc

In the doc for the journey API, it says that requests can be made using:

"when"

while actually you need "arrival" or "departure" as query key words, if I am not mistaken.

get the public endpoint running again (use BVG endpoint for now)

$ curl -v 'https://2.vbb.transport.rest/stations/9007102/departures?when=1529416634&duration=30'
* Connected to 2.vbb.transport.rest (54.37.75.136) port 443 (#0)
> GET /stations/9007102/departures?when=1529416634&duration=30 HTTP/1.1
> Host: 2.vbb.transport.rest
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 504 Gateway Time-out
< Server: nginx/1.10.3 (Ubuntu)
< Date: Tue, 19 Jun 2018 13:53:00 GMT
< Content-Type: text/html
< Content-Length: 192
< Connection: keep-alive
<
<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

thanks for having a look!

improve /stops, /locations & /journeys documentation

Hi,

I wanted to reactivate some old code using your API which has been decommissioned, and it seems there may be some things not working.
For instance, I have been trying these links from your documentation
https://3.vbb.transport.rest/journeys?from=900000023201&to.id=900980720&to.name=ATZE%20Musiktheater&to.latitude=52.543333&to.longitude=13.351686 { "error": true, "msg": "invalid to.type: location" }

https://3.vbb.transport.rest/stops Cannot GET /stops

I discovered that when trying to do a /journeys request passing an origin in address form. Then I tried some of the listed examples and got errors too.

Also, could you please clarify in docs e.g. for address format if address AND latitude AND longitude are all three required? I suppose either of the three as long as to and from are univocally determined, but may be mistaken. Thanks for looking into it!

Missing when on cancelled trips

It seems, that the when field is null when a trip has been canceled.
If it is possible, it would be nice, if you'd provide the original time even if a trip is cancelled.

It would be easier in many situations to identify the cancelled trip.

Departures: delays and departure time

First of all I wanted to say thanks! As someone who has worked a bit with the original VBB API I can't say how grateful I am for this effort. ❤️

Two questions regarding departures, though:

  1. The docs mention that delays are returned as milliseconds. All delays I have seen coming in are fairly small numbers (usually between 60 and 480, always cleanly divisible by 60) which had/has me believe that these values might actually be rather represented as seconds. Could you comment on this?
  2. If a delay is returned does the when property represent the original arrival time or has the delay been factored in already?
  3. I have seen a realtime key somewhere around here being mentioned. Am I right to assume that this property would represent the product of when and delay? This key is not present in the responses I'm getting from the API, though.

error 500 on previously working radar call

Hello,

the previously working

https://vbb.transport.rest/radar?north=52.46361877479345&east=13.546850681304933&south=52.45944815947133&west=13.533332347869875

now returns me a 500 server error and when opened in a browser, this

{
"error": true,
"msg": "Cannot read property 'Symbol(Symbol.iterator)' of undefined"
}

GET /stations/nearby failing

While trying to get a response for the /stations/nearby GET request:

curl 'https://2.vbb.transport.rest/stations/nearby?latitude=52.52725&longitude=13.4123'

.. I am recieving this response:

<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.10.3 (Ubuntu)</center>
</body>
</html>

Would be glad, if someone could proof this request and confirm that issue. Thanks!

Inconsistent results between this API and VBB Fahrinfo app / other HAFAS clients

Hi!

We noted that in some cases we get inconsistent results between this API and what we can see on the VBB page.

Example request API: https://3.vbb.transport.rest/journeys?from=900000205466&to=900000205151&arrival=1582614000
Similar request made in the vbb Fahrinfo webapp (doesn't allow deep linking unfortunately):
Screen Shot 2020-02-27 at 12 07 34

Note that the last result does not show up in the vbb-rest response. I cross-validated this with https://transportr.app/ which to my knowledge uses the HAFAS API under the hood:
signal-attachment-2020-02-27-121019

Can you help us find out what happened there?

enhancing documentation

I tried to use your example (I want to use your API for FHEM) but was not successful on terminal using Mac OS. Typing
https://3.vbb.transport.rest/journeys?from=900000017104&to=900000017101
as it is shown in the documentation gives
{"error":true,"msg":"res.json is not a function"}
What am I making wrong?

Filter departures and arrivals by line id

Currently the /stops/:id/departures and the /stops/:id/arrivals only take the direction and the duration as filter arguments.
However, sometimes it would also be interesting (or easier) to filter by a specific line (eg. ?line=u5) or do this in addition to the existing filters.

timestamp differs from API time

If I put in
https://3.vbb.transport.rest/stops/900000051371/departures?direction=900023201&when=13:15:00
I thought I will get busses departing after 13:15. But I get
..."when":"2019-11-01T14:20:00+01:00"...
Am I making something wrong or is there a difference (I have to use MEZ and the API uses a different timezone)?

accessing 3.vbb.transport.rest gives SSL Error

Hello,
I have used your api for a long time but since today, I get a weird error message related to SSL when I try to o a request with it.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
    cnx.do_handshake()
  File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1915, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error
    _raise_current_error()
  File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_read_bytes', 'tlsv1 alert internal error')]

I must say, that I use Python, but I haven't updated anything since it changed its behaviour.
Is it the same in Javascript? Is that a mistake on my (two different) PCs with Python?

Regards,
Lukas

Error with $ npm start

Redis is running, clone & install worked, but npm start produces an error:

❯ npm start

> [email protected] start ~/vbb-rest
> forever start --uid vbb-rest index.js

sh: forever: command not found

npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/6.1.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.1.0
npm ERR! npm  v3.9.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `forever start --uid vbb-rest index.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script 'forever start --uid vbb-rest index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vbb-rest package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     forever start --uid vbb-rest index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vbb-rest
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vbb-rest
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!    ~/vbb-rest/npm-debug.log

See also the attached error log.

Maybe I have to npm install -g --production into /usr/local instead of my "normal" user directory?
npm-debug.log.zip

error 502 on previously working journeys call

Hi,

the call

https://vbb.transport.rest/journeys?from.latitude=52.45706&from.longitude=13.54009&to=900000192001&results=1&when=1518683781

now returns a 502 error and when opened from browser, this json:

{
"error": true,
"msg": "VBB error: HCI Service: request failed"
}

forever is a requirement

'make sure npm is installed'
run 'npm install forever --global' if don't have forever installed yet. forever is useful to keep the node node server running 'forever'

How do you get the id of the departing line?

Say I got this result from asking for the departures:

[
	{
		"ref": "1|25705|1|86|8022018",
		"station": {
			"type": "station",
			"name": "Wiesenwinkel",
			"coordinates": {
				"latitude": 52.594429,
				"longitude": 13.380983
			},
			"id": "900000132500",
			"products": {
				"suburban": false,
				"subway": false,
				"tram": true,
				"bus": false,
				"ferry": false,
				"express": false,
				"regional": false
			}
		},
		"when": "2018-02-08T21:42:00+01:00",
		"direction": "Mitte, Am Kupfergraben",
		"line": {
			"type": "line",
			"name": "M1",
			"class": 4,
			"productCode": 2,
			"productName": "Str",
			"product": "tram",
			"mode": "train",
			"public": true,
			"id": "m1",
			"symbol": "M",
			"nr": 1,
			"metro": true,
			"express": false,
			"night": false
		},
		"remarks": [
			null,
			null
		],
		"trip": 25705,
		"delay": 0
	}
]

How would I get the line id?
I would have though json[0].line.id would have done it but I just get the lowercase version of the name and not a valid id,

Use SSL

For so many reasons, encryption is a must-have nowadays.

document which routes are GTFS-based & which HAFAS-based

Hi, I'm trying to use this library and I'm following a workflow like this:

  • Find stations by name (query='mollstr')
  • Select a station and get details (name='Berlin, Mollstr./Otto-Braun-Str.' id='900000100040')
  • Select a line from the station (name=M8 id='17463_900')
  • Select the variant with most trips (the one with 371 trips)
  • Get the first and last stop of that variant (first_stop_id='070301009267' last_stop_id='070301008858')

Last step throws an error like this:

{
  "isHafasError": true,
  "request": "{\"lang\":\"en\",\"svcReqL\":[{\"meth\":\"LocDetails\",\"req\":{\"locL\":[{\"type\":\"S\",\"lid\":\"A=1@L=001009267@\"}]}}],\"client\":{\"type\":\"IPA\",\"id\":\"VBB\",\"name\":\"vbbPROD\",\"v\":\"4010300\"},\"ext\":\"VBB.1\",\"ver\":\"1.16\",\"auth\":{\"type\":\"AID\",\"aid\":\"hafas-vbb-apps\"}}",
  "url": "https://fahrinfo.vbb.de/bin/mgate.exe?mic=bb4618f0b209632fb61e9dae462aabe2&mac=a246d90418328ad9249c3dda23fdc111",
  "statusCode": 400,
  "isClient": true,
  "code": "INVALID_REQUEST",
  "message": "location/stop not found",
  "hafasErrorCode": "LOCATION",
  "hafasErrorMessage": "HCI Service: location missing or invalid",
  "error": true,
  "msg": "HAFAS error: location/stop not found"
}

The query I'm running looks like this https://v5.vbb.transport.rest/stops/070301009267

I think my workflow is correct and this is a bug. Can you confirm?

Cancelled trips

First of all: Thank you for your service.
I'm trying to build a display which shows the next departure at my favorite S-Bahn station. Your API is a great help to realize it.

Regarding the output I have a question:
How can I recognize that a trip has been canceled?

Example:

Response from http://mobile.bahn.de/:
S 85 >> Berlin-Schöneweide (S)
10:08 Fahrt fällt aus, Gl. 2

Response from the API:
{'direction': 'S Schöneweide', 'station': {'products': {'suburban': True, 'regional': False, 'express': False, 'tram': False, 'bus': False, 'ferry': False, 'subway': False}, 'name': 'S+U Wittenau', 'coordinates': {'longitude': 13.335479, 'latitude': 52.596388}, 'id': '900000096101', 'type': 'station'}, 'remarks': [None, None], 'trip': 43004, 'line': {'class': 1, 'productCode': 0, 'nr': 85, 'productName': 'S-5', 'name': 'S85', 'symbol': 'S', 'product': 'suburban', 'express': False, 'metro': False, 'night': False, 'id': 's85', 'type': 'line', 'mode': 'train'}, 'ref': '1|43004|2|86|5122017', 'when': '2017-12-05T10:08:00+01:00', 'delay': None}

Thanks in advance!

nextStation for station departures does not work

This seems to be an issue on the VBB's end as the hafas api you provide also fails. To verify: the following request outlined in the documentation fails (returns empty array).

I've tried everything I can think of, but to no avail. Any ideas on how to fix this? Thanks!

# at U Kottbusser Tor, in direction U Görlitzer Bahnhof
curl 'https://2.vbb.transport.rest/stations/900000013102/departures?nextStation=900000014101&results=3'

How do you get stations on a departure?

Say I get a departure:

https://vbb.transport.rest/stations/900000132500/departures

and I get:

[
	{
		"ref": "1|25705|1|86|8022018",
		"station": {
			"type": "station",
			"name": "Wiesenwinkel",
			"coordinates": {
				"latitude": 52.594429,
				"longitude": 13.380983
			},
			"id": "900000132500",
			"products": {
				"suburban": false,
				"subway": false,
				"tram": true,
				"bus": false,
				"ferry": false,
				"express": false,
				"regional": false
			}
		},
		"when": "2018-02-08T21:42:00+01:00",
		"direction": "Mitte, Am Kupfergraben",
		"line": {
			"type": "line",
			"name": "M1",
			"class": 4,
			"productCode": 2,
			"productName": "Str",
			"product": "tram",
			"mode": "train",
			"public": true,
			"id": "m1",
			"symbol": "M",
			"nr": 1,
			"metro": true,
			"express": false,
			"night": false
		},
		"remarks": [
			null,
			null
		],
		"trip": 25705,
		"delay": 0
	}
]

How can I get what the next stations along the line are? In this case:

["900000132010", "900000132014"]

for trams towards "Rosenthal Nord".

I tried to use the refs generated but they don't seem to work. I used the following url:

https://vbb.transport.rest/journeys/legs/1%7C25705%7C1%7C86%7C8022018

and got

Cannot GET /journeys/legs/1%7C25705%7C1%7C86%7C8022018

add custom IDs outside of the VBB service area

Again, I want to stress how much this API has been a help.

However, I have come across the fact that for a bunch of cities from neighbouring federal states (Niedersachsen, Sachsen, Mecklenburg-Vorpommern, Sachsen-Anhalt), there is no callable ID for a station nearby. And hence, I was wondering, if there is a easy possibility to add these cities or whether this would go to the very core of the API.
request_for_adding.xlsx

agency.txt link in docs is broken

the agency.txt link here is broken, so it took me a while to find out how where operator IDs come from
if you don't wanna host it on your own site i think it would be perfectly fine to replace it with a link to the current GTFS

  • personally i think it would be useful to have an /operators/:id endpoint to help quickly figure them out, or maybe an /operators?query with fuzzy matching that would return 1 for "sbahn" or 796 for "bvg"

API endpoint not available

Hi,
first I would like to thank you for your work.
I am not completely sure if the actual problem is on your site, but at the moment the API endpoint is not available.
BR, Mike

ID must have 7 or 9 digits

I'm hitting a weird error for some journeys (http below is the httpie cli).

I query for stops close to a particular location (http 'https://3.vbb.transport.rest/stops/nearby?longitude=13.471680&latitude=51.763612'):

[
  {
    "type": "stop",
    "id": "900000415725",
    "name": "Hohenbucko, Wasserturm",
    "location": {
      "type": "location",
      "id": "900415725",
      "latitude": 51.762333,
      "longitude": 13.473958
    },
    "products": {
      "suburban": false,
      "subway": false,
      "tram": false,
      "bus": true,
      "ferry": false,
      "express": false,
      "regional": false
    },
    "distance": 211
  },
  {
    "type": "stop",
    "id": "900000415722",
    "name": "Hohenbucko, Dorfmitte",
    "location": {
      "type": "location",
      "id": "900415722",
      "latitude": 51.765803,
      "longitude": 13.468745
    },
    "products": {
      "suburban": false,
      "subway": false,
      "tram": false,
      "bus": true,
      "ferry": false,
      "express": false,
      "regional": false
    },
    "distance": 317
  },
  {
    "type": "stop",
    "id": "900000415724",
    "name": "Hohenbucko, Schule",
    "location": {
      "type": "location",
      "id": "900415724",
      "latitude": 51.760778,
      "longitude": 13.46701
    },
    "products": {
      "suburban": false,
      "subway": false,
      "tram": false,
      "bus": true,
      "ferry": false,
      "express": false,
      "regional": false
    },
    "distance": 450
  },
  {
    "type": "stop",
    "id": "900000415721",
    "name": "Hohenbucko, Bhf",
    "location": {
      "type": "location",
      "id": "900415721",
      "latitude": 51.776159,
      "longitude": 13.457544
    },
    "products": {
      "suburban": false,
      "subway": false,
      "tram": false,
      "bus": true,
      "ferry": false,
      "express": false,
      "regional": false
    },
    "distance": 1701
  }
]

And similarly with other places. The ID returned on the stop has 12 digits. Now trying to request a journey I get this response (http 'https://3.vbb.transport.rest/journeys?from=900000245645&to=900000415725&arrival=1578898800'):

{
    "error": true,
    "msg": "ID must have 7 or 9 digits."
}

What does that mean? I also tried deleting some of the zeros to match the location id (see response above) but I get the same error. Where would I get the right ID? Or is something wrong with the validation code? I grepped the source code for the error message but couldn't find anything.

The stops endpoint seems to have information about the stop with the original (12-digit) id. The journey endpoint doesn't.

Something similar happened to me elsewhere. I query a nearby stop to the center of Frankfurt (Main) and get 800000002041. Trying to query for stop or journey information returns a HAFAS error: location/stop not found. Is there a mismatch between returned IDs and available stop information / journey information? Note that the above error does not complain about a stop that's not found but here it does.

Question about the service

Yet another question 😁 . — I noticed that the endpoint is down since last night and was wondering what the relationship between the service and the official API endpoint is like to get a sense of reliability.
This project doesn't require an API key or does rate limiting as you state in the documentation which is brilliant (just as is the CORS support). However — and forgive me for being nosey — it makes me wonder a bit how this magic will work over time. Are you anyhow affiliated with the official API team? Would you recommend to build a production application using your endpoint at this point?

Thanks again for all the hard work!

api has changed and broken my app

ive built https://www.trainspotting.berlin over the last weeks, and it died last night. (through vbb-client)
Instead of returning usual results, I'm getting this ->

curl https://2.vbb.transport.rest/stations/900000055101/departures\?results\=10
<h1><code>vbb-rest</code> APIs</h1>
<p>An HTTP API for Berlin &#x26; Brandenburg public transport.</p>
<p><a href="https://github.com/derhuerst/vbb-rest/blob/2/docs/index.md" rel="nofollow">documentation</a></p>

Wrong ordering of departures

Now and then, the /stations/:id/departures endpoint returns the departures in a wrong time order. This happens in the afternoon. Right now the "2017-11-14T17:19:00+01:00" entry apears before the "2017-11-14T16:19:00+01:00"

I use the folowing request:

https://vbb.transport.rest/stations/900000230091/departures?duration=120

and I get:

[
{
"ref": "1|32126|6|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:19:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 32126,
"delay": 0
},
{
"ref": "1|32129|1|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T16:19:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 32129,
"delay": 0
},
{
"ref": "1|37734|4|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T16:28:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37734,
"delay": 120
},
{
"ref": "1|37729|4|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T16:39:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37729,
"delay": 0
},
{
"ref": "1|32139|1|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T16:46:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 32139,
"delay": 0
},
{
"ref": "1|32130|0|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T16:59:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 32130,
"delay": 0
},
{
"ref": "1|37731|5|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:06:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37731,
"delay": 0
},
{
"ref": "1|37734|5|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:26:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37734,
"delay": 0
},
{
"ref": "1|37729|5|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:39:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37729,
"delay": 0
},
{
"ref": "1|32138|6|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:46:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 32138,
"delay": 0
},
{
"ref": "1|37728|6|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T17:59:00+01:00",
"direction": "S Griebnitzsee",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37728,
"delay": 0
},
{
"ref": "1|37733|2|86|14112017",
"station": {
"type": "station",
"name": "Potsdam, Sternwarte",
"coordinates": {
"latitude": 52.404136,
"longitude": 13.100438
},
"id": "900000230091",
"products": {
"suburban": false,
"subway": false,
"tram": false,
"bus": true,
"ferry": false,
"express": false,
"regional": false
}
},
"when": "2017-11-14T18:06:00+01:00",
"direction": "S Babelsberg/Schulstr.",
"line": {
"type": "line",
"name": "616",
"class": 8,
"productCode": 3,
"productName": "Buv",
"product": "bus",
"mode": "bus",
"id": "616",
"symbol": null,
"nr": 616,
"metro": false,
"express": false,
"night": false
},
"remarks": [
null
],
"trip": 37733,
"delay": 0
}
]

The problem ist not there if I use a duration < 100.

Stations nearby options not working

Hello,
the 'GET /stations/nearby' has 2 parameters which don't work: results and distance

For example:
https://vbb.transport.rest/stations/nearby?latitude=52.52725&longitude=13.4123
and
https://vbb.transport.rest/stations/nearby?latitude=52.52725&longitude=13.4123&results=1
give the same output

No response if duration is > 18

I have noticed an error, where there is no response for departures if the duration is set to > 18.

It occurs on Hauptbahnhof station with this route:
https://vbb.transport.rest/stations/900000003201/departures?when=now&duration=19
I can reproduce this with the use of vbb-client also.

It seems that all values > 18 produce this behaviour.

This is the response:

{
	"error": true,
	"msg": "HCI Service: request failed"
}

Some requests given as examples in the documentation don't work

Hi :)

Some requests to https://v6.vbb.transport.rest that are given as examples in the documentation don't seem to work.
For example, https://v6.vbb.transport.rest/stops/900000058101/departures?results=5 given in the Getting Started section (https://github.com/derhuerst/vbb-rest/blob/6/docs/getting-started.md#2-fetch-departures-at-a-stop) results in a Hafas error:

{
	"isHafasError": true,
	"code": "NOT_FOUND",
	"isCausedByServer": false,
	"hafasCode": "LOCATION",
	"url": "https://fahrinfo.vbb.de/bin/mgate.exe?",
	"hafasResponseId": "4k24wm4g6q469m4s",
	"hafasMessage": "HCI Service: location missing or invalid",
	"hafasDescription": "Während der Suche ist ein interner Fehler aufgetreten"
}

The same is true for other examples in the docs. For example, https://v6.vbb.transport.rest/journeys?from=900000023201&to.id=900980720&to.name=ATZE+Musiktheater&to.latitude=52.54333&to.longitude=13.35167 given as an example here returns the same Hafas error.

Using https://v5.vbb.transport.rest instead works though (at least for these two examples).

Thank you!

Some examples are not succeeding

Some examples from the example page break. Maybe the API has changed?

Accessing https://3.vbb.transport.rest/stops?query=jungfernheide:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /stops</pre>
</body>
</html>
[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/stops?query=mehrigndamm&fuzzy=true:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /stops</pre>
</body>
</html>
[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/stops?weight=9120&coordinates.latitude=52.493575:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /stops</pre>
</body>
</html>
[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/stops/all:
{"error":true,"msg":"id must be an IBNR"}[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/lines/531:
{"error":true,"msg":"Line not found."}[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/journeys?from=…&to=…&results=3&bus=false&tickets=true:
{"error":true,"msg":"from must be an IBNR"}[OK]
------------------------------------------------------------------------------
Accessing https://3.vbb.transport.rest/trips/1|32082|1|86|26062017?lineName=RE7:
{"error":true,"msg":"HAFAS error: HCI Service: problems during service execution"}[OK]
------------------------------------------------------------------------------

For testing I used this script:

#!/bin/bash

example() {
    url=$1
    shift
    echo "Accessing $url:"
    if curl -s $* $url; then
        echo "[OK]"
    else
        echo "[FAIL]"
    fi
    echo "------------------------------------------------------------------------------"
}

example 'https://3.vbb.transport.rest/stops?query=jungfernheide'
example 'https://3.vbb.transport.rest/stops?query=mehrigndamm&fuzzy=true'
example 'https://3.vbb.transport.rest/stops?weight=9120&coordinates.latitude=52.493575'
example 'https://3.vbb.transport.rest/stops/all'
example 'https://3.vbb.transport.rest/stops/nearby?latitude=52.52725&longitude=13.4123'
example 'https://3.vbb.transport.rest/stops/900000013102'
example 'https://3.vbb.transport.rest/stops/900000013102/departures?direction=900000014101'
example 'https://3.vbb.transport.rest/stops/900000013102/departures?when=tomorrow%206pm&results=3'
example 'https://3.vbb.transport.rest/lines?operator=796&variants=true'
example 'https://3.vbb.transport.rest/lines/531'
example 'https://3.vbb.transport.rest/shapes/1269'
example 'https://3.vbb.transport.rest/journeys?from=900000017104&to=900000017101'
example 'https://3.vbb.transport.rest/journeys?from=900000023201&to.id=900980720&to.name=ATZE%20Musiktheater&to.latitude=52.543333&to.longitude=13.351686'
example 'https://3.vbb.transport.rest/journeys?from=…&to=…&results=3&bus=false&tickets=true'
example 'https://3.vbb.transport.rest/trips/1|32082|1|86|26062017?lineName=RE7'
example 'https://3.vbb.transport.rest/locations?query=Alexanderplatz'
example 'https://3.vbb.transport.rest/locations?query=Pestalozzistra%C3%9Fe%2082%2C%20Berlin&poi=false&stops=false'
example 'https://3.vbb.transport.rest/radar?north=52.52411&west=13.41002&south=52.51942&east=13.41709'
example 'https://3.vbb.transport.rest/maps/bvg-tram' -L -o bvg-tram-map.pdf 
example 'https://3.vbb.transport.rest/logos/tram.svg' -L -o tram.svg 

IPv6 connection issues

hi there, seems to me like there are some IPv6 reachability issues. There is an AAAA record:

;; ANSWER SECTION:
v6.bvg.transport.rest.	3513	IN	CNAME	thuya.jannisr.de.
thuya.jannisr.de.	82713	IN	AAAA	2a01:4f8:c012:91b7::

but that seems to not be reachable from my network:

% curl -6 -v https://v6.bvg.transport.rest/
* processing: https://v6.bvg.transport.rest/
*   Trying [2a01:4f8:c012:91b7::]:443...
* connect to 2a01:4f8:c012:91b7:: port 443 failed: Operation timed out
* Failed to connect to v6.bvg.transport.rest port 443 after 75008 ms: Couldn't connect to server
* Closing connection
curl: (28) Failed to connect to v6.bvg.transport.rest port 443 after 75008 ms: Couldn't connect to server

just in case it was something misconfigured on my side, I also tried on this website and it too cannot connect:

https://ready.chair6.net/?url=https%3A%2F%2Fv6.bvg.transport.rest%2F

this is causing a bit of a problem since some environments I am using default to v6 and time out without trying v4 (micropython)

let me know if you need more details!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.