Trip planner (r:plan)¶
http://rels.goabout.com/plan
The trip-planner allowes you to actually plan a trip. It helps you by returning Trip alternatives (p:trip-alternatives) that contains a set of trips fitting the request.
Trip alternatives (p:trip-alternatives) can be created by posting a PlanRequest to the Trip planner (r:plan).
Example¶
{
"_links": {
"http://rels.goabout.com/plan" : {
"href" : "https://api.goabout.com/plan"
}
}
}
POST¶
Example¶
$ curl -d'{ "fromHref": "https://api.goabout.com/location/stop/4b95d4b4", "toHref": "https://api.goabout.com/location/stop/593ca7f8", "departure": "2017-03-01T18:00:00Z" }' -H'Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6' 'https://api.goabout.com/plan'
{
"tripHrefs" : [ "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c" ],
"sortIndex" : {
"plannedTime" : [ "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c" ],
"departure" : [ "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c" ],
"arrival" : [ "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c" ]
},
"planRequest" : {
"fromHref" : "https://api.goabout.com/location/stop/4b95d4b4",
"toHref" : "https://api.goabout.com/location/stop/593ca7f8",
"departure" : "2017-03-01T18:00:00.000Z"
},
"groupIndex" : [ [ "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c" ] ],
"_links" : {
"http://rels.goabout.com/user" : {
"href" : "https://api.goabout.com/user/3286"
},
"self" : {
"href" : "https://api.goabout.com/trip-alternatives/2831618"
}
},
"_embedded" : {
"http://rels.goabout.com/trip" : [ {
"departure" : "2017-03-01T18:01:40.000Z",
"arrival" : "2017-03-01T18:41:34.000Z",
"duration" : 2394,
"distance" : 45022.59831136586,
"transfers" : 0,
"from" : {
"latitude" : 52.3789197836,
"longitude" : 4.90088939667
},
"to" : {
"latitude" : 52.1663529517,
"longitude" : 4.48206782341
},
"tripLegs" : [ {
"departure" : "2017-03-01T18:01:40.000Z",
"departureTime" : "2017-03-01T18:01:40.000Z",
"scheduledDepartureTime" : "2017-03-01T18:01:40.000Z",
"arrival" : "2017-03-01T18:03:59.000Z",
"arrivalTime" : "2017-03-01T18:03:59.000Z",
"scheduledArrivalTime" : "2017-03-01T18:03:59.000Z",
"departureLocation" : {
"type" : "station",
"label" : "Station Amsterdam Centraal",
"coordinates" : {
"latitude" : 52.3789197836,
"longitude" : 4.90088939667
},
"code" : "asd",
"name" : "Amsterdam Centraal",
"moreInfoHref" : "https://api.goabout.com/redirect?url=https%3A%2F%2Fgoabout.com%2Factuele-vertrektijden%2Fstation-amsterdam-centraal%2Fbase64%3Ac3RvcC80Yjk1ZDRiNA&utm_source=QN7P2gFSaGAnvGOG3kkz1aWC1z76%2F%2Fyk&utm_medium=geocoder&utm_term=information&signature=ADcF%2BxFz9pqejJ8qhsN90wQlgqga5vAiZnF4tDdR8nI%3D"
},
"arrivalLocation" : {
"type" : "trainStop",
"label" : "Station Amsterdam Centraal, spoor 2a",
"coordinates" : {
"latitude" : 52.379014748,
"longitude" : 4.89927470684
},
"name" : "Amsterdam Centraal",
"platform" : "2a",
"change" : false
},
"mode" : {
"label" : "Lopen",
"name" : "Lopen",
"modeType" : "walk"
},
"distance" : 170.341,
"shape" : "kgu~Hue|\\k@xBYbAKb@EEI\\^^d@b@JL",
"selfHref" : "https://api.goabout.com/trip-leg/20b5d31c-cd46-4adf-bcf5-07fb54e8c2f3",
"intermediateStops" : [ ]
}, {
"departure" : "2017-03-01T18:04:00.000Z",
"departureTime" : "2017-03-01T18:04:00.000Z",
"scheduledDepartureTime" : "2017-03-01T18:04:00.000Z",
"arrival" : "2017-03-01T18:40:00.000Z",
"arrivalTime" : "2017-03-01T18:40:00.000Z",
"scheduledArrivalTime" : "2017-03-01T18:40:00.000Z",
"dynamic" : true,
"departureLocation" : {
"type" : "trainStop",
"label" : "Station Amsterdam Centraal, spoor 2a",
"coordinates" : {
"latitude" : 52.379014748,
"longitude" : 4.89927470684
},
"name" : "Amsterdam Centraal",
"platform" : "2a",
"change" : false
},
"arrivalLocation" : {
"type" : "trainStop",
"label" : "Station Leiden Centraal, spoor 8",
"coordinates" : {
"latitude" : 52.166539,
"longitude" : 4.48302
},
"name" : "Leiden Centraal",
"platform" : "8",
"change" : false
},
"mode" : {
"label" : "Intercity van NS",
"name" : "Intercity",
"modeType" : "train",
"agencyName" : "NS",
"headsign" : "Vlissingen",
"logoHref" : "https://goabout.com/pages/agency/256x256/ns.png",
"moreInfoHref" : "https://goabout.com/pages/agency/ns"
},
"distance" : 44741.91331136586,
"selfHref" : "https://api.goabout.com/trip-leg/76e6049c-56b8-4ad8-aed1-ce3e41f18399",
"intermediateStops" : [ {
"location" : {
"type" : "station",
"label" : "Station Amsterdam Sloterdijk",
"coordinates" : {
"latitude" : 52.3885625372,
"longitude" : 4.83716011047
},
"code" : "ass",
"name" : "Amsterdam Sloterdijk",
"moreInfoHref" : "https://api.goabout.com/redirect?url=https%3A%2F%2Fgoabout.com%2Factuele-vertrektijden%2Fstation-amsterdam-sloterdijk%2Fbase64%3Ac3RvcC9jMTY0MWUxNg&utm_source=QN7P2gFSaGAnvGOG3kkz1aWC1z76%2F%2Fyk&utm_medium=geocoder&utm_term=information&signature=DVVQFmgPnj0UDKwPynHCoM%2FVTD%2B%2BrO1I7UQ2%2BxOBdBM%3D"
},
"departure" : "2017-03-01T18:09:00.000Z"
}, {
"location" : {
"type" : "station",
"label" : "Station Haarlem",
"coordinates" : {
"latitude" : 52.3880485284,
"longitude" : 4.63878393173
},
"code" : "hlm",
"name" : "Haarlem",
"moreInfoHref" : "https://api.goabout.com/redirect?url=https%3A%2F%2Fgoabout.com%2Factuele-vertrektijden%2Fstation-haarlem%2Fbase64%3Ac3RvcC81NzdlNTQ0Zg&utm_source=QN7P2gFSaGAnvGOG3kkz1aWC1z76%2F%2Fyk&utm_medium=geocoder&utm_term=information&signature=H2R18HWu2A3qlzr1irmWgHzD7bu24ekYH8B8rQ3P48I%3D"
},
"departure" : "2017-03-01T18:20:00.000Z"
}, {
"location" : {
"type" : "station",
"label" : "Station Heemstede-Aerdenhout",
"coordinates" : {
"latitude" : 52.3594641541,
"longitude" : 4.6067905426
},
"code" : "had",
"name" : "Heemstede-Aerdenhout",
"moreInfoHref" : "https://api.goabout.com/redirect?url=https%3A%2F%2Fgoabout.com%2Factuele-vertrektijden%2Fstation-heemstede-aerdenhout%2Fbase64%3Ac3RvcC9iMDNmZDVjOQ&utm_source=QN7P2gFSaGAnvGOG3kkz1aWC1z76%2F%2Fyk&utm_medium=geocoder&utm_term=information&signature=8P%2BjgoHHsbBScTF67oSIK2LeJalsEanB3D7v68kj%2B9k%3D"
},
"departure" : "2017-03-01T18:24:00.000Z"
} ]
}, {
"departure" : "2017-03-01T18:40:00.000Z",
"departureTime" : "2017-03-01T18:40:00.000Z",
"scheduledDepartureTime" : "2017-03-01T18:40:00.000Z",
"arrival" : "2017-03-01T18:41:34.000Z",
"arrivalTime" : "2017-03-01T18:41:34.000Z",
"scheduledArrivalTime" : "2017-03-01T18:41:34.000Z",
"departureLocation" : {
"type" : "trainStop",
"label" : "Station Leiden Centraal, spoor 8",
"coordinates" : {
"latitude" : 52.166539,
"longitude" : 4.48302
},
"name" : "Leiden Centraal",
"platform" : "8",
"change" : false
},
"arrivalLocation" : {
"type" : "station",
"label" : "Station Leiden Centraal",
"coordinates" : {
"latitude" : 52.1663529517,
"longitude" : 4.48206782341
},
"code" : "ledn",
"name" : "Leiden Centraal",
"moreInfoHref" : "https://api.goabout.com/redirect?url=https%3A%2F%2Fgoabout.com%2Factuele-vertrektijden%2Fstation-leiden-centraal%2Fbase64%3Ac3RvcC81OTNjYTdmOA&utm_source=QN7P2gFSaGAnvGOG3kkz1aWC1z76%2F%2Fyk&utm_medium=geocoder&utm_term=information&signature=NJKi3JPrHXnEbRVlPrbl2NDPPPyYgSHqfNlead7PqEU%3D"
},
"mode" : {
"label" : "Lopen",
"name" : "Lopen",
"modeType" : "walk"
},
"distance" : 110.34400000000001,
"shape" : "kxk}HwpjZzAzBEHOSEJKX",
"selfHref" : "https://api.goabout.com/trip-leg/077e3e3a-4c12-4cea-baad-28cdb501dcc9",
"intermediateStops" : [ ]
} ],
"notifications" : [ ],
"delay" : 0,
"emission" : 1565.9669658978053,
"cost" : 8.05,
"_links" : {
"self" : {
"href" : "https://api.goabout.com/trip/ced4a321-634c-4b0a-b44a-5013fc898f5c"
}
}
} ],
"http://rels.goabout.com/trip-selection" : {
"_links" : {
"http://rels.goabout.com/trip-alternatives" : {
"href" : "https://api.goabout.com/trip-alternatives/2831618"
},
"self" : {
"href" : "https://api.goabout.com/trip-alternatives/2831618/trip-selection"
}
}
}
}
}
Reference¶
PlanRequest¶
fromHref: | URI The URI indicating the original requested departure location. |
---|---|
toHref: | URI The URI indicating the original requested arrival location. |
returnFromTripHref: | |
URI The href of a different existing trip. This will make the planner plan the return journey. If set; a departure time must be given; this will not accept an arrival time. fromHref and toHref will be ignored if set. | |
arrival: | DateTime The date-time to arrive at. Exactly one of arrival and departure must be set. |
departure: | DateTime The date-time to depart at. Exactly one of arrival and departure must be set. |