Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there some possibility to get show "Steig" and Delay information? #2

Closed
jens-maus opened this issue Feb 15, 2017 · 12 comments
Closed

Comments

@jens-maus
Copy link

First of all, thanks for collecting all information about public APIs to access DVB information. Some things I would like to be able to query (I am using your dvbjs) would be:

  • Get information on the "Steig" similar to what the VVO Abfahrsauskunft ist showing
  • Get information on the Delay (+X and -X) times also shown in VVO Abfahrsauskunft with red/green colors.

Do you have any idea if this is already possible via the vvo-online.de API?

@kiliankoe
Copy link
Owner

kiliankoe commented Feb 15, 2017

I have seen this information being published via the webapi, here's two quick excerpts.

"Platform": {
   "Name": "4",
   "Type": "Platform"
},
"RealTime": "\/Date(1487175617000+0100)\/",
"ScheduledTime": "\/Date(1487175600000+0100)\/",

via

curl -X "POST" "https://webapi.vvo-online.de/dm?format=json" \
     -H "Content-Type: application/json;charset=UTF-8" \
     -d $'{
  "stopid": "33000037",
  "limit": 30,
  "mot": [
    "Tram",
    "CityBus",
    "IntercityBus",
    "SuburbanRailway",
    "Train",
    "Cableway",
    "Ferry",
    "HailedSharedTaxi"
  ],
  "shorttermchanges": true,
  "time": "2017-02-15T16:19:44Z",
  "isarrival": false
}'

Unfortunately neither dvbjs nor any other of the wrappers use that endpoint directly, but the widgets and/or EFA. I'll hopefully be coming around to adding some more info regarding the api calls in this repo in the near future.

So it seems the info does at least exist somewhere. Maybe it can be added into the wrappers as well.

@jens-maus
Copy link
Author

If you want I can work on integrating this into dvbjs and thus changing it to using the webapi instead.

@kiliankoe
Copy link
Owner

If you want to, sure! I'm not entirely sure if dvbjs has any users beside you at this point and I don't have a lot of time to work on it currently, so you might be on your own if that's ok. But any contribution is welcome!
I don't have any info on the longevity and availability of the webapi though, so it might be nice not to drop the old stuff (the widgets endpoint) if that's in any way possible? But since EFA is supposed to be shut down in the long term anyways, migrating off of that might not be a bad idea either^^

Here's what I currently have on the webapi with curl examples:

Departure Monitor:

curl -X "POST" "https://webapi.vvo-online.de/dm?format=json" \
     -H "Content-Type: application/json;charset=UTF-8" \
     -d $'{
  "stopid": "33000037",
  "limit": 30,
  "mot": [
    "Tram",
    "CityBus",
    "IntercityBus",
    "SuburbanRailway",
    "Train",
    "Cableway",
    "Ferry",
    "HailedSharedTaxi"
  ],
  "shorttermchanges": true,
  "time": "2017-02-15T16:39:32Z",
  "isarrival": false
}'

PointFinder:

curl -X "POST" "https://webapi.vvo-online.de/tr/pointfinder?format=json" \
     -H "Content-Type: application/json;charset=UTF-8" \
     -d $'{
  "dvb": true,
  "query": "postpl",
  "stopsOnly": false,
  "limit": 0
}'

PointFinder with coordinate:

curl -X "POST" "https://webapi.vvo-online.de/tr/pointfinder?format=json" \
     -H "Content-Type: application/json;charset=UTF-8" \
     -d $'{
  "limit": 0,
  "assignedstops": true,
  "query": "coord:4621016:5655920"
}'

RouteChanges:

curl -X "POST" "https://webapi.vvo-online.de/rc?format=json" \
     -H "Content-Type: application/json;charset=UTF-8" \
     -d $'{
  "shortterm": true
}'

Trips:

curl -X "POST" "https://webapi.vvo-online.de/tr/trips?format=json" \
     -H "Accept: application/json, text/plain, */*" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d $'{
  "origin": "33000134",
  "destination": "33000013",
  "time": "2016-11-13T15:55:46.552Z",
  "shorttermchanges": true,
  "isarrivaltime": false,
  "standardSettings": {
    "walkingSpeed": "Normal",
    "maxChanges": "Unlimited",
    "footpathToStop": 5,
    "mot": [
      "Tram",
      "CityBus",
      "IntercityBus",
      "SuburbanRailway",
      "Train",
      "Cableway",
      "Ferry",
      "HailedSharedTaxi"
    ],
    "includeAlternativeStops": true
  },
  "mobilitySettings": {
    "mobilityRestriction": "None"
  }
}'

Handyticket (probably rather useless):

curl -X "POST" "https://webapi.vvo-online.de/tr/handyticket?format=json" \
     -H "Accept: application/json, text/plain, */*" \
     -H "Content-Type: application/json; charset=utf-8" \
     -d $'{
  "origin": {
    "id": "33000134",
    "name": "Dresden Münchner Platz",
    "farezone": 10
  },
  "destination": {
    "id": "33000013",
    "name": "Dresden Albertplatz",
    "farezone": 10
  },
  "priceLevel": 1
}'

@jens-maus
Copy link
Author

@kiliankoe I am mainly interested in tuning the departure monitor feature to using the webapi. So I will concentrate on that and send you a proper pull request if possible. One question already is, do you know how I can get the stopid the webapi seems to require? Obviously I cannot provide the station name as a string but have to provide this artificial stopid. Is there another api I can use to convert station names to actual ids?

@kiliankoe
Copy link
Owner

Afaict that's what the Pointfinder endpoint is for. The output looks like this for a query of "postpl" as an example.

{
  "PointStatus": "List",
  "Status": {
    "Code": "Ok"
  },
  "Points": [
    "33000037|||Postplatz|5658730|4621656|0||",
    "36040112||Aue (Sachs)|Postplatz|5606043|4549703|0||",
    "33007557||Bautzen|Postplatz|5674144|4669959|0||",
    "36040241||Eibenstock|Postplatz|5595521|4542641|0||",
    "14908883||Görlitz|Postplatz|5672771|4708965|0||",
    "36040863||Lindenau (b Aue)|Postplatz|5606136|4542992|0||",
    "31000979||Reichenbach (Vogtl)|Postplatz|5609693|4521544|0||",
    "36020504||Stollberg (Erzgeb)|Postplatz|5619679|4555330|0||"
  ],
  "ExpirationTime": "\/Date(1487308019915+0100)\/"
}

Seems like the points array will have to parsed separately though, with the ID seemingly being the first param there. Then something missing (for these results at least), an optional city/town, name of the stop, coordinates, whatever the 0 is for and something else that's missing.

@jens-maus
Copy link
Author

@kiliankoe Thanks, already found that as well and I am currently working on integrating this. Should have something ready by the end of the evening.

@kiliankoe
Copy link
Owner

Awesome! And thank you! Looking forward to it 😊

@jens-maus
Copy link
Author

@kiliankoe Almost done. Do you have an idea what the following output in depatureMonitor means?

[...]
Diva":{"Number":"21063","Network":"voe"}

I couldn't find out what "Diva" might stand for?
In addition, on the mobil page of dvb I can spot the following post parameters being used:

{"stopid":"33000832","time":"2017-02-16T12:34:00.000Z","isarrival":false,"limit":30,"shorttermchanges":true,"mentzonly":false,"mot":["Tram","CityBus","IntercityBus","SuburbanRailway","Train","Ferry","HailedSharedTaxi"]}

Do you know what isarrival, shorttermchanges and mentzonly might stand for? The rest I could perfectly guess.

@kiliankoe
Copy link
Owner

I've heard diva being used somewhere, can't quite recall it though :/

The post param isArrival probably specifies if the search is for arrival or departure times and I'm guessing shortTermChanges allows rather short changes as well, that would otherwise be impossible for some users.
Mentz is a company behind one the systems afaik, although I have no clue what the param is for. Maybe for only using their data?

@HeEAaD
Copy link
Contributor

HeEAaD commented Feb 18, 2017

Regarding "mentz" and "diva": https://www.mentz.net/fahr-und-dienstplanung/diva/

@kiliankoe
Copy link
Owner

Thanks! 👍

@kiliankoe
Copy link
Owner

Thanks for integrating this into dvbjs! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants