Skip to content

Unofficial API Documentation for Israel Railways API

chaimkut edited this page Aug 1, 2018 · 7 revisions

API used by website

How to sniff the website API?

The matter is slightly complicated since the site uses HTTPS and therefore the communication cannot be read directly. Instead, you'll have to set your local SSLKEYLOGFILE environment variable to a file path on your system. This will log the various pre-master secrets your browser uses on HTTPS sites. (This worked for me using Chrome, though not on Firefox). You must then configure Wireshark with this file path and then Wireshark will be able to decrypt all HTTPS communication. Further details on the SSL Wireshark Wiki. You can then use the filter: ssl && (ip.src_host eq rail.co.il ip.dest_host eq rail.co.il). This will allow you to view all communications between the web client and the server.

GetRoutes

  • URL

    apiinfo/api/Plan/GetRoutes

  • Method

    GET

  • URL Params

    Required

    OId=[integer] TId=[integer] Date=[integer] Hour=[integer]

  • Success Response

    • Code 200

    • Content

      {
          "MessageType": 2,
          "Message": null,
          "Data": {
              "Error": null,
              "Details": {
                  "Origin": "2300",
                  "Destination": "2200",
                  "Date": "24/07/2018 00:00:00",
                  "SugKav": "P",
                  "Hour": "0"
              },
              "StartIndex": 30,
              "Routes": [{
                  "Train": [{
                      "Trainno": "420",
                      "OrignStation": "2300",
                      "DestinationStation": "2200",
                      "ArrivalTime": "24/07/2018 17:47:00",
                      "DepartureTime": "24/07/2018 17:40:00",
                      "StopStations": [],
                      "LineNumber": "73201840",
                      "Route": "1",
                      "Midnight": false,
                      "Handicap": true,
                      "DirectTrain": false,
                      "TrainParvariBenironi": null,
                      "ReservedSeat": true,
                      "Platform": "1",
                      "DestPlatform": "1"
                  }],
                  "IsExchange": false,
                  "EstTime": "00:07:00"
              }, ....],
              "BeforeRoutes": null,
              "Rates": [],
              "Delays": [],
              "TrainPositions": [{
                  "CurrentStation": 2300,
                  "DifMin": 3,
                  "NextStation": 2200,
                  "TrainNumber": 122,
                  "DifType": "DELAY",
                  "TotalKronot": "009",
                  "SugNayad": "SIM",
                  "StopPoint": "ד"
              }, ...],
              "Omasim": [{
                  "TrainNumber": 134,
                  "Stations": [{
                      "StationNumber": 400,
                      "OmesPercent": 0.055,
                      "Shmurim": "Y",
                      "Time": "22:20",
                      "Platform": 4
                  }, ...]
              },
              ]
          }
      }
      
  • Error Response

    • Code 200 OK (!)

    • Content

      {
          "MessageType": 2,
          "Message": null,
          "Data": {
              "CustomPropertys": [{
                  "Id": "3700",
                  "Heb": ["תל אביב - סבידור מרכז"],
                  "Eng": ["Tel Aviv-Savidor Center"],
                  "Rus": ["Тель-Авив - Мерказ - Центральная"],
                  "Arb": ["تل ابيب – ساڤيدور المركز"]
              }...]
          }
      }
      

    (long list of train stations)

  • Sample Call

    https://www.rail.co.il/apiinfo/api/Plan/GetRoutes?OId=2300&TId=3600&Date=20180724&Hour=1830

  • Notes

GeneralUpdates

  • URL

    apiinfo/api/Info/GeneralUpdates

  • Method

    GET

  • URL Params

    Required

    id=[integer]

  • Success Response

    • Code 200

    • Content

      <ServiceResultOfArrayOfUpdateStationd2PbYAiG
              xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://schemas.datacontract.org/2004/07/SolBox.Rail.Api.OM">
              <Data>
                      <UpdateStation>
                              <EndValidationOfReport>2018-07-29T01:00:00</EndValidationOfReport>
                              <Float>true</Float>
                              <NameArb/>
                              <NameEng/>
                              <NameHeb>הפסקה זמנית של שירות הרכבות בתחנות מודיעין</NameHeb>
                              <NameRus/>
                              <Order>1400</Order>
                              <ReportImage>/_catalogs/masterpage/solboxrail/img/sound.svg</ReportImage>
                              <ReportType>report1</ReportType>
                              <StartValidationOfReport>2018-07-22T21:00:00</StartValidationOfReport>
                              <Station
                                      xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
                                      <UpdateContentArb/>
                                      <UpdateContentEng/>
                                      <UpdateContentHeb>
      הפסקת השירות תחל ביום ד' 25.7.18 בשעה 21&#58;00&#160; ותסתיים ביום א' 29.7.18 בשעה 04&#58;00/&#160;תחנות מודיעין תהיינה סגורות.&#160;בנוסף, בלילה שבין יום ה' 26.7.18 (00&#58;20) ליום א' 29.7.18 (04&#58;45) יופסק השירות בתחנת נתב&quot;ג. לשירותכם, יועמדו שירותי היסעים (ללא תשלום)
      </UpdateContentHeb>
                                      <UpdateContentRus/>
                                      <UpdateLinkArb/>
                                      <UpdateLinkEng/>
                                      <UpdateLinkHeb>
      https://www.rail.co.il/Pages/Updates/modiin-closure.aspx
      </UpdateLinkHeb>
                                      <UpdateLinkRus/>
                              </UpdateStation>
                              <UpdateStation>
                                      <EndValidationOfReport>2018-07-27T15:00:00</EndValidationOfReport>
                                      <Float>true</Float>
                                      <NameArb>
      إيقاف مؤقت لخدمة القطارات بين محطة بنيامينا ومحطة الخضيرة
      </NameArb>
                                      <NameEng>Temporary halt of train services </NameEng>
                                      <NameHeb>
      הפסקה זמנית של שירות הרכבות בין תחנת בנימינה לתחנת חדרה מערב
      </NameHeb>
                                      <NameRus>Временный перерыв в движении поездов </NameRus>
                                      <Order>1300</Order>
                                      <ReportImage>/_catalogs/masterpage/solboxrail/img/sound.svg</ReportImage>
                                      <ReportType>report1</ReportType>
                                      <StartValidationOfReport>2018-07-15T21:00:00</StartValidationOfReport>
                                      <Station
                                              xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
                                              <UpdateContentArb>
      ​بسبب أعمال لتطوير البنية التحتية للسكة الحديدية.سيبدأ إيقاف الخدمة في الليلة ما بين يوم الخميس 26.7.2018 ويوم الجمعة 27.7.2018&#160;في الساعة 00&#58;01 وسينتهي يوم الجمعة 27.7.2018 في الساعة 18&#58;00.
      </UpdateContentArb>
                                              <UpdateContentEng>
      Due to track improvement works.Services will stop from the night between Thursday, 26.7.18 and Friday, 27.7.18 at 00&#58;01 and resume on Friday, 27.7.18 &#160;at 18&#58;00.
      </UpdateContentEng>
                                              <UpdateContentHeb>
      בשל עבודות לשדרוג תשתית המסילה.&#160;הפסקת השירות תחל בלילה שבין יום ה' 26.7.18 ליום ו' 27.7.18 בשעה 00&#58;01 ותסתיים ביום ו' 27.7.18 בשעה 18&#58;00.
      </UpdateContentHeb>
                                              <UpdateContentRus>
      по причине ремонта железнодорожной инфраструктуры.Движение поездов прекратится в 00&#58;01 ночи с четверга 26.07 на пятницу 27.07.2018 и возобновится в 18&#58;00 пятницы 27.07.2018.
      </UpdateContentRus>
                                              <UpdateLinkArb>
      https://www.rail.co.il/ar/Pages/UdatesAR/Caesarea-closure.aspx
      </UpdateLinkArb>
                                              <UpdateLinkEng>
      https://WWW.rail.co.il/en/Pages/updates/Caesarea-closure.aspx
      </UpdateLinkEng>
                                              <UpdateLinkHeb>
      https://www.rail.co.il/Pages/Updates/Caesarea-closure.aspx
      </UpdateLinkHeb>
                                              <UpdateLinkRus>
      https://www.rail.co.il/ru/Pages/UpdatesRU/Caesarea-closure.aspx
      </UpdateLinkRus>
                                      </UpdateStation>
                                      <UpdateStation>
                                              <EndValidationOfReport>2018-10-31T22:00:00</EndValidationOfReport>
                                              <Float>true</Float>
                                              <NameArb>تحديثات للجنود</NameArb>
                                              <NameEng>Updates for soldiers</NameEng>
                                              <NameHeb>עדכונים לחיילים</NameHeb>
                                              <NameRus>Информация для военнослужащих</NameRus>
                                              <Order>300</Order>
                                              <ReportImage>/_catalogs/masterpage/solboxrail/img/sound.svg</ReportImage>
                                              <ReportType>report1</ReportType>
                                              <StartValidationOfReport>2018-04-29T02:00:00</StartValidationOfReport>
                                              <Station
                                                      xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                                                      <d4p1:string>9700</d4p1:string>
                                                      <d4p1:string>5800</d4p1:string>
                                                      <d4p1:string>5900</d4p1:string>
                                                      <d4p1:string>7300</d4p1:string>
                                                      <d4p1:string>7320</d4p1:string>
                                                      <d4p1:string>1280</d4p1:string>
                                                      <d4p1:string>3400</d4p1:string>
                                                      <d4p1:string>6300</d4p1:string>
                                                      <d4p1:string>4100</d4p1:string>
                                                      <d4p1:string>2800</d4p1:string>
                                                      <d4p1:string>4680</d4p1:string>
                                                      <d4p1:string>4690</d4p1:string>
                                                      <d4p1:string>7500</d4p1:string>
                                                      <d4p1:string>9200</d4p1:string>
                                                      <d4p1:string>3500</d4p1:string>
                                                      <d4p1:string>3100</d4p1:string>
                                                      <d4p1:string>4660</d4p1:string>
                                                      <d4p1:string>1300</d4p1:string>
                                                      <d4p1:string>2200</d4p1:string>
                                                      <d4p1:string>2300</d4p1:string>
                                                      <d4p1:string>2100</d4p1:string>
                                                      <d4p1:string>5410</d4p1:string>
                                                      <d4p1:string>9000</d4p1:string>
                                                      <d4p1:string>1240</d4p1:string>
                                                      <d4p1:string>6700</d4p1:string>
                                                      <d4p1:string>1250</d4p1:string>
                                                      <d4p1:string>4800</d4p1:string>
                                                      <d4p1:string>8700</d4p1:string>
                                                      <d4p1:string>1220</d4p1:string>
                                                      <d4p1:string>8550</d4p1:string>
                                                      <d4p1:string>5000</d4p1:string>
                                                      <d4p1:string>5150</d4p1:string>
                                                      <d4p1:string>1600</d4p1:string>
                                                      <d4p1:string>9650</d4p1:string>
                                                      <d4p1:string>3300</d4p1:string>
                                                      <d4p1:string>3310</d4p1:string>
                                                      <d4p1:string>1500</d4p1:string>
                                                      <d4p1:string>1260</d4p1:string>
                                                      <d4p1:string>2500</d4p1:string>
                                                      <d4p1:string>4250</d4p1:string>
                                                      <d4p1:string>4640</d4p1:string>
                                                      <d4p1:string>2820</d4p1:string>
                                                      <d4p1:string>4170</d4p1:string>
                                                      <d4p1:string>700</d4p1:string>
                                                      <d4p1:string>1400</d4p1:string>
                                                      <d4p1:string>7000</d4p1:string>
                                                      <d4p1:string>4500</d4p1:string>
                                                      <d4p1:string>8800</d4p1:string>
                                                      <d4p1:string>9100</d4p1:string>
                                                      <d4p1:string>9800</d4p1:string>
                                                      <d4p1:string>5200</d4p1:string>
                                                      <d4p1:string>5010</d4p1:string>
                                                      <d4p1:string>9600</d4p1:string>
                                                      <d4p1:string>3700</d4p1:string>
                                                      <d4p1:string>3600</d4p1:string>
                                                      <d4p1:string>4900</d4p1:string>
                                                      <d4p1:string>4600</d4p1:string>
                                              </Station>
                                              <UpdateContentArb>
      ​لراحتكم، ركزنا تفاصيل ساعات خدمات النقليات من محطات القطار إلى مدينة التدريب العسكري &quot;هبهاديم&quot;.​
      </UpdateContentArb>
                                              <UpdateContentEng>
      ​For your convenience, we have listed the times of all shuttle services from train stations to Camp Ariel Sharon (HaBahadim).
      </UpdateContentEng>
                                              <UpdateContentHeb>
      ​לנוחותכם, ריכזנו את פירוט שעות שירותי ההיסעים מתחנות הרכבת לעיר הבה&quot;דים.&#160;
      </UpdateContentHeb>
                                              <UpdateContentRus>
      ​Для удобства пассажиров приводим общую сводку расписания подвозок от железнодорожных станций до военного городка в Негеве.​​
      </UpdateContentRus>
                                              <UpdateLinkArb>
      https://WWW.rail.co.il/ar/pages/udatesar/soldiersar.aspx
      </UpdateLinkArb>
                                              <UpdateLinkEng>https://WWW.rail.co.il/en/Pages/soldiersEN.aspx</UpdateLinkEng>
                                              <UpdateLinkHeb>https://www.rail.co.il/pages/soldiers.aspx</UpdateLinkHeb>
                                              <UpdateLinkRus>
      https://WWW.rail.co.il/ru/Pages/UpdatesRU/soldiersRU.aspx
      </UpdateLinkRus>
                                      </UpdateStation>
                              </Data>
                              <Message/>
                              <MessageType>Success</MessageType>
                      </ServiceResultOfArrayOfUpdateStationd2PbYAiG>
      
  • Error Response

    • Code 400 BAD REQUEST

    • Content

      <Error>
              <Message>The request is invalid.</Message>
      </Error>
      
  • Sample Call

    https://rail.co.il/apiinfo/api/Info/GeneralUpdates

  • Notes

CheckActiveVersion

  • URL

    apiinfo/api/taarif/CheckActiveVersion

  • Method

    GET

  • Success Response

    • Code 200

    • Content

      {
          "VersionId": 58,
          "ContentVersionId": 1,
          "RestrictionsLastUpdateDate": "2018-06-28T14:22:54.54",
          "FileVersion": 131.0
      }
      
  • Error Response

  • Sample Call

    https://www.rail.co.il/apiinfo/api/taarif/CheckActiveVersion

  • Notes

GetInfo

  • URL

    apiinfo/api/taarif/GetInfo

  • Method

    GET

  • URL Params

    Required

    VersionId=[integer]

  • Success Response

    • Code 200
    • Content
  • Error Response

    • Code 404 Not Found

    • Content

      <Error>
              <Message>
      No HTTP resource was found that matches the request URI 'https://www.rail.co.il/apiinfo/api/taarif/GetInfo'.
      </Message>
      </Error>
      
  • Sample Call

    https://www.rail.co.il/apiinfo/api/taarif/GetInfo?VersionId=58

  • Notes


API used by the Android application

How to sniff the mobile API?

Install tPacketCapture on your Android phone. This allows you to record the phone's traffic in a file. After using the Android train app for a period of time, suspend sniffing. Then copy to your local computer the pcap network file with all of the recorded traffic. Open the file in Wireshark and use a filter like http && (ip.src == 191.233.107.3 || ip.dest == 191.233.107.3). This IP is a Microsoft cloud IP. Be aware that load balancing may have caused your mobile to use a different IP (perhaps in the same subnet).

Stations

  • URL

    /rail/v01/Stationsv2/

  • Method

    GET

  • Success Response

    • Code 200

    • Content

      {
            "Stations": {
                "Station": [{
                    "DescriptionArb": "",
                    "ArbName": "وفاكيم",
                    "StationId": "9700",
                    "DescriptionHe": "אופקים",
                    "DescriptionEn": "OFKM",
                    "InterChangeStation": "2",
                    "StationKind": "1",
                    "Parking": "2",
                    "ParkingPay": "1",
                    "Handicap": "2",
                    "EngName": "Ofakim",
                    "Location": {
                        "Latitude": 31.321891,
                        "Longitude": 34.633948
                    }
                },....
             }]
            }
      
  • Sample Call

    http://191.233.107.3/rail/v01/Stationsv2/

  • Notes

schedule

  • URL

    /rail/v01/schedulev2/?&origin=2300&destination=3600&date=25/07/2018%2000:00&hours=12

  • Method

    GET

  • Required

    origin=[integer] destination=[integer] date=[integer] hours=[integer]

  • Success Response

    • Code 200

    • Content

      {
          "LUZ": {
              "@xmlns": "",
              "Details": {
                  "Origin": "2300",
                  "Destination": "3600",
                  "Date": "25/07/2018 00:00:00",
                  "LastUpdateTime": "03/07/2018 07:10:42",
                  "Hours": "0"
              },
              "SugKav": "P",
              "SugKavDesc": "פרברי",
              "Directs": {
                  "Direct": [{
                      "train": {
                          "Trainno": "8425",
                          "OrignStation": "2300",
                          "DestinationStation": "3600",
                          "DestPlatform": "2",
                          "ArrivalTime": "25/07/2018 02:02:00",
                          "DepartureTime": "25/07/2018 01:14:00",
                          "StopStations": {
                              "Station": [{
                                  "StationId": "2800",
                                  "ArrivalTime": "25/07/2018 01:32:00",
                                  "DepartureTime": "25/07/2018 01:32:00",
                                  "Platform": "1"
                              }, {
                                  "StationId": "3100",
                                  "ArrivalTime": "25/07/2018 01:39:00",
                                  "DepartureTime": "25/07/2018 01:39:00",
                                  "Platform": "1"
                              }, {
                                  "StationId": "3300",
                                  "ArrivalTime": "25/07/2018 01:46:00",
                                  "DepartureTime": "25/07/2018 01:46:00",
                                  "Platform": "1"
                              }, {
                                  "StationId": "3500",
                                  "ArrivalTime": "25/07/2018 01:56:00",
                                  "DepartureTime": "25/07/2018 01:56:00",
                                  "Platform": "4"
                              }]
                          },
                          "LineNumber": "2",
                          "Route": "1",
                          "WagonType": "0",
                          "Midnight": "0",
                          "Handicap": "1",
                          "DirectTrain": "0",
                          "TrainParvariBenironi": "P",
                          "ReservedSeat": "0",
                          "Platform": "1",
                          "IsSamePlatformIsland": null
                      }
                  }, ...]
                  }
              },
              "Times": {
                  "Start": "25/07/2018 05:02:29.264",
                  "End": "25/07/2018 05:02:33.484",
                  "Diff": "4.220"
              },
              "TSD": {
                  "Train": [{
                      "@num": "8425",
                      "Station": [{
                          "@Num": "1840",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "00:30",
                          "@Platform": "2"
                      }, {
                          "@Num": "1820",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "00:38",
                          "@Platform": "1"
                      }, {
                          "@Num": "1400",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "00:50",
                          "@Platform": "1"
                      }, {
                          "@Num": "2100",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:03",
                          "@Platform": "1"
                      }, {
                          "@Num": "2300",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:14",
                          "@Platform": "1"
                      }, {
                          "@Num": "2800",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:32",
                          "@Platform": "1"
                      }, {
                          "@Num": "3100",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:39",
                          "@Platform": "1"
                      }, {
                          "@Num": "3300",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:46",
                          "@Platform": "1"
                      }, {
                          "@Num": "3500",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "01:56",
                          "@Platform": "4"
                      }, {
                          "@Num": "3600",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "02:02",
                          "@Platform": "2"
                      }, {
                          "@Num": "3700",
                          "@Omes": "",
                          "@Shmurim": "",
                          "@Time": "02:09",
                          "@Platform": "2"
                      }]
                  }, ...]
                  }]
              },
              "Messages": null,
              "AverageTime": "01:18:00",
              "Rates": {
                  "Rate": [{
                      "PriceCode": "0",
                      "PassangerType": "1",
                      "PassangerTypeText": "כללי",
                      "TicketType": "1",
                      "TicketTypeText": "כוון אחד",
                      "Tariff": "27.5",
                      "PassangerTypeTextEN": "Adult",
                      "TicketTypeTextEN": "Single",
                      "PassangerTypeTextARB": "بالغ",
                      "TicketTypeTextARB": "اتجاه واحد"
                  }, ...]
              },
              "Delays": {
                  "Delay": [{
                      "Date": "20180725",
                      "Time": "082642",
                      "Train": "105",
                      "Min": "0024",
                      "Station": "2800"
                  }, ...]
              },
              "TPS": {
                  "TP": [{
                      "#whitespace": ["\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                            ", "\n                                                          "],
                      "Trainno": "105",
                      "CurLastStation": "2800",
                      "NextStation": "3600",
                      "DifMin": "0024",
                      "DifType": "DELAY",
                      "TotKr": "007",
                      "SugNid": "DD",
                      "StopPoint": "ג"
                  }, ...]
              }
          }
      }
      
  • Error Response

    • Code 200 OK (!)

    • Content

      {
          "Error": {
              "@xmlns": "",
              "ErrorId": "3",
              "Description": "המערכת אינה מציגה לוח זמנים לתאריך שחלף",
              "Exception": null
          }
      }
      
  • Sample Call

    http://191.233.107.3/rail/v01/schedulev2/?&origin=2300&destination=3600&date=25/07/2018%2000:00&hours=12

  • Notes

Clone this wiki locally