Research Västtrafik API for view #332
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K#332
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It would be nice to be able to show incoming/outgoing traffic from Skövde Centralstation (maybe other bus stations).
@a24hirsa 's idea!
https://developer.vasttrafik.se/apis
Parent Issue: #309 #21
What is needed to get started
To use the API, a developer account is required.
The first steps are:
Get started guide:
[https://developer.vasttrafik.se/guides/get-started](Get started)
Relevant APIs
GET /journeysThe main function used to find travel routes between two places.
It returns a list of possible journeys based on the search parameters you provide.
Link:
[https://developer.vasttrafik.se/apis/13/v4#/Journeys/get_journeys](Get Journey)
GET /locations/by-textThis endpoint is used to search for stops by name.
It is useful when the application needs to show journeys from Skövde to other cities, because the destination stop first needs to be found by name.
Link:
[https://developer.vasttrafik.se/apis/13/v4#/Locations/get_locations_by_text](Get locations by text)
GET /locations/by-coordinatesThis endpoint is used to find stops close to a specific coordinate.
It is useful when the application needs to show journeys within Skövde, especially from nearby bus stops.
Link:
[https://developer.vasttrafik.se/apis/13/v4#/Locations/get_locations_by_coordinates](Get locations by coordinates)
For Skövde resecentrum, the coordinates are according to Jernhusen:
GID for relevant stops:
To find the gid go to västtrafik Hållplatser and in the "Enter stop, address or place" field enter the desired bus/train stop, and in the URl above in your web browser, you will find the gid.
A simple way to structure the solution is
To work with the API in JavaScript, the package can be installed with:
npm install planera_resa --saveExample of a simple journey request in JavaScript: (extracted from vsttrafik-api/github-repo) All comments and unnecessary fields were removed for readability.
In this example:
originGidis the starting stopdestinationGidis the destination stoplimitdecides how many journey results should be returnedincludeNearbyStopAreas: true allows the API to also consider nearby stop areasThe research is well structured and follows a clear flow that is quite straightforward, which makes it easy to understand. The research clearly explains all the necessary basic steps that exists from account to app to the API use.
The research has also identified the most important endpointers that are needed and clearly explains what they are used for and how they connect together.
The flow from finding stops to then requesting journeys is also described in such a way that makes it easy to understand how the system would work in practice
overall, the research is clear, accurate and well structured and will provide a solid understanding of how the Västtrafik API works.