C# library to fetch data from Trafikverket Trafikinfo API.
This is not an official library from Trafikverket.
You can find more information about the API here
PM> Install-Package Trafikinfo
Fetch information about Stockholm Central station.
using(var api = new Trafikinfo(new Configuration { Key = "yoursecretkey", Referer = "https://www.yourdomain.com" }))
{
var request = new Request();
request.AddQuery(new Query(ObjectType.TrainStation));
request.Queries[0].Filter.AddOperator(new FilterOperator(OperatorType.Equals, "LocationSignature", "cst"));
var response = api.Request(request);
}
The following dependencies are used.
Tests are using NUnit
There is an example .runsettings included. Copy it to .runsettings and add your API-key in it. You can get a key at Trafikverket.