Contents:
This API provides a listing of the saved journeys of a specified user, having regard to any privacy settings.
Journeys are listed most recent first.
This API call implements cursor-based pagination.
In order to return a successful listing, a user must have enabled the listing of their journeys in their profile. However, in future, it is likely that this call will be expanded to enable credentials to be supplied so that the private journeys of an authenticated user can be retrieved.
Example which retrieves the most recent 3 routes planned by a user who has made their route listing public. (In this example, a limit of 3 locations has been set, to avoid a long example on this page, but normally a limit of perhaps 25 or 50 would be a good starting point for the first page of results.)
https://api.cyclestreets.net/v2/journeys.user?username=someuser&format=flat&datetime=friendly&limit=3
Result:
{ "pagination": { "latest": 43047091, "urlLater": "https://api.cyclestreets.net/v2/journeys.user?username=someuser&format=flat&limit=3&datetime=friendly&after=43047091", "hasLater": false, "top": 43047091, "bottom": 43047056, "hasEarlier": true, "urlEarlier": "https://api.cyclestreets.net/v2/journeys.user?username=someuser&format=flat&limit=3&datetime=friendly&before=43047056", "earliest": 37022101, "count": 3, "total": 15 }, "journeys": { "43047091": { "id": 43047091, "name": "Belgrove Street to The Mall", "datetime": "10:28am, 8th December 2014", "plans": { "balanced": { "name": "Balanced", "length": 3862, "time": 901, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047091&plans=balanced" }, "quietest": { "name": "Quietest", "length": 4170, "time": 1154, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047091&plans=quietest" }, "fastest": { "name": "Fastest", "length": 3801, "time": 850, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047091&plans=fastest" } }, "lengthAverage": 3944, "timeAverage": 968, "url": "https://www.cyclestreets.net/journey/43047091/", "idText": "43,053,458" }, "43053453": { "id": 43053453, "name": "York Street to Thoday Street", "datetime": "10:27am, 8th December 2014", "plans": { "balanced": { "name": "Balanced", "length": 2011, "time": 390, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43053453&plans=balanced" } }, "lengthAverage": 2011, "timeAverage": 390, "url": "https://www.cyclestreets.net/journey/43053453/", "idText": "43,053,453" }, "43047056": { "id": 43047056, "name": "York Street to Riverside Bridge", "datetime": "10:27am, 8th December 2014", "plans": { "balanced": { "name": "Balanced", "length": 808, "time": 193, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047056&plans=balanced" }, "quietest": { "name": "Quietest", "length": 936, "time": 242, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047056&plan=quietest" }, "fastest": { "name": "Fastest", "length": 750, "time": 158, "url": "https://api.cyclestreets.net/v2/journey.retrieve?itinerary=43047056&plans=fastest" } }, "lengthAverage": 831, "timeAverage": 198, "url": "https://www.cyclestreets.net/journey/43047056/", "idText": "43,053,451" } } }
If specified, the datetime field (if requested in the fields list) will be converted from unixtime (the default output format) to a formatted version; the available output formats are:
date ('g:ia, jS F Y', $date)
in PHPdate ('jS F, Y', $date)
in PHPJSON object, as per the example above.
The results are always ordered most-recent first.
Each itinerary shows a list of plan types that were planned at the time of creation, with API URLs and basic metadata for each. The ordering of plans, filtered by their existence, is balanced, quietest, fastest, leisure1, leisure2, … .
For each itinerary, a route length in metres and time is shown. These are each the average of the values in the plans.
Each itinerary shows a list of plan types that were planned at the time of creation, with API URLs for each.
There is a pagination data block at the start. The pagination fields are documented below.
This API call implements cursor-based pagination.
The key fields top and bottom restate the top-most and bottom-most values in the current view of the data. The latest and earliest give the user's absolute latest and earliest journeys planned. The *later/*earlier fields enable clients to make further requests to paginate forwards or backwards.
The pagination fields are as follows:
JSON object containing an error key and a text string.
Example error (text string will vary):
{ "error": "There is no such user, or they have disabled viewing of journeys." }