Till senaste kommentaren
Detta inlägg är gammalt och kan innehålla inaktuell information.

Access denied in SL Hållplatser och Linjer 2

When I try to connect to that service by way of my key I get access denied as you may check at:

Thanks for your help,


  • Hello Fabrizio!

    You are using the wrong key for Your API call.

    You are calling a method that belongs to Resrobot - Search Trip with a key that belongs to SL Hållplatser och Linjer 2.
    Correct key for the call You are making is ucijjffrJmyx1o7manSnMg0bLW7uNJXC

    The API - SL Hållplatser och Linjer 2 is called by method like http://api.sl.se/api2/LineData.xml?model=[model]&key=[key]

    Read documentation https://www.trafiklab.se/api/sl-hallplatser-och...
    for more information.

    Best regards, Åke

    Team Trafiklab
  • Basically I am looking for the api giving me access to the metros and buses for a city and their lines to bootstrap everything else from there.
    Anyway I think I was easily misled by the sample: if you look in the documentation about the SL Hållplatser och Linjer 2 api you find:
    https : //api.trafiklab.se/samtrafiken/resrobot/TimeTablePeriod.json?key=ABC123&apiVersion=2.1
    proper, I was unsuccessfully trying to use and no mention to the api you kind gave me.

    Yet by looking at the documentation, I saw it is a different kind of beast I shall need much later in the process of integration as it allows, for what I understood, to get the route from one place to another with the transit service of choice.

    As a matter of fact I now need quite the reverse information: the bus and metros available in a certain city.

    Thanks for you feedback,

  • To say the truth I found most of the apis seem devoted to planning travels and/or get real time information, what is fine, good and useful, but I was at a loss at finding the api allowing me to load the actual information at the base of all this jazz. I hoped it was SL Hållplatser och Linjer 2, but I was evidently wrong. What may I use instead?

    Thanks again,

  • Any new information?

  • Hello Fabrizio,

    I think that the only way for You to get the information you need is by filter the GTFS extract for the cities You want to extract information from.

    We can't help You with suggestions how to implement it.
    Please, use the GTFS documentation to find out how to to do this in the best way.
    (You could try to contact other developers to get implementation suggestions in Kundo)

    ps.The documentation to the API -SL Hållplatser och Linjer 2 looks fine. ds.

    Best regards, Åke

    Team Trafiklab
  • It might be so, but what is the url and possibly the pag documentation useful to understand how to use it. I followed that page and it misled me.
    Of course, this si an open thread I think, so other developers are warmly invited to contribute.

  • Hi again,

    The top-documentation is at https://www.trafiklab.se/api/gtfs-sverige/dokum...

    Each GTFS-file is linked to Googles documentation under the section:


    Sweden.zip innehåller ett antal filer som ingår i GTFS-formatet.
    Flera delar i GTFS är inte obligatoriska och all information som omnämns i specifikationen finns inte med i Samtrafikens export (till exempel realtid och prisinformation).
    Länkarna nedan går till Googles dokumentation.

    Good Luck!

    Team Trafiklab
  • It might be so, but it is not clear which key to use in each service; I really wonder why you do not employ the same key for each one.
    I tried:
    with the key from SL Hållplatser och Linjer 2 and got again the invalid key error; which one should I use instead?

  • As for the former link it brings to a page reporting:
    Samtrafiken i Sverige AB,http://www.samtrafiken.se,sv,2015-08-11
    I do not think is of much use.

  • Ok, I think I found, the key is the one for the GTFS file, of course. I downloaded the file and have a look to it.

  • Yet the documentation reports:
    agency.txt One or more transit agencies that provide the data in this feed.
    stops.txt Individual locations where vehicles pick up or drop off passengers.
    routes.txt Transit routes. A route is a group of trips that are displayed to riders as a single service.
    trips.txt Trips for each route. A trip is a sequence of two or more stops that occurs at specific time.
    stop_times.txt Times that a vehicle arrives at and departs from individual stops for each trip.
    calendar.txt Dates for service IDs using a weekly schedule. Specify when service starts and ends, as well as days of the week where service is available.
    calendar_dates.txt Exceptions for the service IDs defined in the calendar.txt file. If calendar_dates.txt includes ALL dates of service, this file may be specified instead of calendar.txt.
    transfers.txt Rules for making connections at transfer points between routes.

    Where not of the chunks seems to refer to the buses and lines for a certain city or general. Is it there somewhere hidden or in some other file?

  • I think the information is in the route.txt or trip.txt. But what is the bus or metro number the users see in front of the bus or at the metro station?
    For instance in route.txt the bus number is the route_short_name_id or the agency_id? The line number is the route_id?
    And it is not clear what the trip.txt corresponds to. It looks like the two table use as pivot field route_id but it is not clear what information trip.txt conveys in addition to route.txt.

  • Also I did not find the pivot table liking the lines to the stops: stop_id seems to be only present in the stops.txt file and in the transfers.txt one with a different meaning. How do I link them tot he lines, assuming they are the ones labeled route_id?

  • I managed to download and extract the files in my cache. What I am just short of is the way to link the routes to the stops.

Kommentera eller skriv ett nytt inlägg

Ditt namn och inlägg kan ses av alla. Din e-post visas aldrig publikt.