Till senaste kommentaren

ResRobot departureBoard maxJourneys

Hej! När jag använder ResRobot Stolptidstabeller departureBoard så verkar den ignorera värdet i maxJourneys. Försöker begränsa det till 2 avgångar.

Exempelanrop:
https://api.resrobot.se/v2.1/departureBoard?id=740015641&format=xml&accessId=00000&direction=740016306&maxJourneys=2
R

Kommentarer

  • Hej R,
    Ja tyvärr så gör den det när man söker resor inom närmsta tiden. Det var en förändring som skedde med uppdateringen till 2.1 och som finns dokumenterat i länken nedan (eller se bild). Vi brukar rekommendera att använda duration istället för att korta ner antal avgångar.

    https://www.trafiklab.se/api/trafiklab-apis/resrobot-v21/timetables/#call



    Mvh
    Sofie

    Sofie på Trafiklab
  • It would be great to have maxJourneys always work and limit the number of results and thus the size of the json!

    Michael
  • Hi Michael,

    Is there a reason why the duration parameter doesn't fit your purpose, as the duration parameter should consistently get you the same time span (e.g. all departures within 30 minutes)?

    Regards,
    Bert
    Bert på Trafiklab
  • Hey,

    my usecase has limited memory available and big json responses kill the app 😀

    I want to be flexible regarding the queried station. So, for 'small' stations it is nice to have as many departures as possible (duration high) but then for 'large' stations there are too many departures if maxJourney is neglected. If I reduce duration, there might be too little departures for 'small' stations. Having a maxJourneys setting always on would be best from my point of view. Hope this helped understanding.

    Michael

    Michael
  • Thanks for the clarification, this helps us understand use cases for future improvements and development. This is however not something we can adjust or fix in the Resrobot API.

    Depending on your use case, the Trafiklab Realtime APIs may be an alternative. While this API also returns large results (a hardcoded window of 60 minutes) the JSON data itself is a bit more compact compared to Resrobot.

    Regards,
    Bert
    Bert på Trafiklab
  • Is there maybe another (hidden) parameter which reduces the amount of data in the json response. I see a lot of redundant information that I would not need. The response json should be smaller than 30Kb in my case.

    Thanks for your help
    Michael

    Michael
  • I belive everyone agrees on that a max number of returned journeys is what we need 😀
    R
  • I would really appreciate if the elements "ProductAtStop" and "Notes" could be turned off by some url-parameter. These are sent for every departure right now in the "departureBoard".

    A similar feature "withProducts=false" exists for "location.name" request already.

    Do you think this could be done?

    Michael

    Michael
  • Hi Michael,

    I've checked the technical documentation to see if we missed a parameter, but there are no parameters other than duration and maxJourneys to control the size of the returned response.

    You could try out the new Trafiklab realtime API departure board. It does not have any means to control duration or the number of responses yet, but the response objects are significantly smaller (1 hour of departures from Slussen, one of the busiest stations, is 38kb). Here we may be able to add a parameter to limit the number of returned responses in the future.

    Regards,
    Bert
    Bert på Trafiklab
  • Thanks for your replies. Sounds good!
    Michael
    Michael

Kommentera eller skriv ett nytt inlägg

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