derhuerst / vbb-rest

An HTTP API for Berlin & Brandenburg public transport.
https://v6.vbb.transport.rest/
ISC License
130 stars 12 forks source link

Some examples are not succeeding #42

Closed Nils-Magnus closed 4 years ago

Nils-Magnus commented 4 years ago

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 
derhuerst commented 4 years ago

related: #40, derhuerst/bvg-rest#6

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'

Can you try /stations for each of these?

Nils-Magnus commented 4 years ago

Ah, that helped a lot. Most request worked out now, except:

https://3.vbb.transport.rest/stations?weight=9120&coordinates.latitude=52.493575 --> returns an empty response

Accessing https://3.vbb.transport.rest/stations/nearby?latitude=52.52725&longitude=13.4123:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /stations/nearby</pre>
</body>
</html>

(but this worked actually with stops).

Is there BTW somewhere a slightly more detailed description of the attributes available? I did some reverse engineering on /stops/nearby for example: So distance is obviously the calculated distance (presumably as the crow flies) in (probably) meters and has to be < 10,000, right?

derhuerst commented 4 years ago

https://3.vbb.transport.rest/stations?weight=9120&coordinates.latitude=52.493575 --> returns an empty response

Yeah, the example is a bit bad: There are currently no stations with a weight of 9120 and a latitude of 52.493575, as the data constantly changes. I changed it.

derhuerst commented 4 years ago

Please reopen if you encounter additional issues related to this.

derhuerst commented 4 years ago

FYI I have set up v5.vbb.transport.rest, which has slightly more intuitive route names and documentation.