Metoder
Följande metoder är tillgängliga och svarar med fint strukturerad data från Tågtider i önskat format.
Get stations
GET /stations.{format}
Returnerar samtliga stationer i givet format. Exempelsvar för /stations.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<stations>
<station>
<id>9</id>
<name>Arlanda C</name>
<code>74,arnc</code>
<slug>arlanda-c</slug>
<lat>59.6496</lat>
<lng>17.9292</lng>
</station>
…
<station>
<id>343</id>
<name>Östersund C</name>
<code>74,ös</code>
<slug>ostersund-c</slug>
<lat>63.1705</lat>
<lng>14.6377</lng>
</station>
</stations>
</response>
Get station
GET /stations/#{station_id}.{format}
Returnerar given station i givet format. Exempelsvar för /stations/243.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<station>
<id>243</id>
<name>Stockholm C</name>
<code>74,cst</code>
<slug>stockholm-c</slug>
<lat>59.3299</lat>
<lng>18.0564</lng>
<transfers>
<transfer>
<id>113203</id>
<arrival>2010-09-05 06:45:00</arrival>
<newArrival>2010-09-05 06:48:00</newArrival>
<departure/>
<newDeparture/>
<origin>Luleå,Boden,Umeå</origin>
<destination/>
<track>6</track>
<train>91</train>
<type>SJ Nattåget</type>
<comment></comment>
<detected>2010-09-04 18:46:21</detected>
<updated/>
</transfer>
…
<transfer>
<id>114943</id>
<arrival/>
<newArrival/>
<departure>2010-09-05 18:11:00</departure>
<newDeparture/>
<origin/>
<destination>Märsta,Knivsta,Uppsala</destination>
<track>3</track>
<train>852</train>
<type>SJ Regional</type>
<comment></comment>
<detected>2010-09-05 06:12:48</detected>
<updated/>
</transfer>
</transfers>
</station>
</response>
Get station departures
GET /stations/#{station_id}/transfers/departures.{format}
Returnerar samtliga avgående (transfers) vid given station i givet format. Exempelsvar för /stations/243/transfers/departures.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<station>
<id>243</id>
<name>Stockholm C</name>
<code>74,cst</code>
<slug>stockholm-c</slug>
<lat>59.3299</lat>
<lng>18.0564</lng>
<transfers>
<transfer>
<id>113229</id>
<departure>2010-09-05 07:11:00</departure>
<newDeparture/>
<destination>Märsta Knivsta Uppsala</destination>
<track>3</track>
<train>808</train>
<type>SJ Regional</type>
<comment></comment>
<detected>2010-09-04 19:11:19</detected>
<updated/>
</transfer>
…
<transfer>
<id>114918</id>
<departure>2010-09-05 18:07:00</departure>
<newDeparture/>
<destination>Enköping Västerås</destination>
<track>6</track>
<train>10756</train>
<type>SJ Regional</type>
<comment></comment>
<detected>2010-09-05 06:07:43</detected>
<updated>/>
</transfer>
</transfers>
</station>
</response>
Get station arrivals
GET /stations/#{station_id}/transfers/arrivals.{format}
Returnerar samtliga ankommande tåg (transfers) vid given station i givet format. Exempelsvar för /stations/243/transfers/arrivals.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<station>
<id>243</id>
<name>Stockholm C</name>
<code>74,cst</code>
<slug>stockholm-c</slug>
<lat>59.3299</lat>
<lng>18.0564</lng>
<transfers>
<transfer>
<id>113203</id>
<arrival>2010-09-05 06:45:00</arrival>
<origin>Luleå,Boden,Umeå</origin>
<track>6</track>
<train>91</train>
<type>SJ Nattåget</type>
<comment></comment>
<detected>2010-09-04 18:46:21</detected>
<updated/>
</transfer>
…
<transfer>
<id>114857</id>
<arrival>2010-09-05 17:49:00</arrival>
<origin>Uppsala,Märsta</origin>
<track>3</track>
<train>853</train>
<type>SJ Regional</type>
<comment></comment>
<detected>2010-09-05 05:52:34</detected>
<updated/>
</transfer>
</transfers>
</station>
</response>
Get transfers
GET /transfers.{format}
Returnerar samtliga transfers i givet format. Exempelsvar för /transfers.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<transfers>
<transfer>
<id>113162</id>
<arrival>2010-09-05 05:40:00</arrival>
<newArrival/>
<departure>2010-09-05 05:42:00</departure>
<newDeparture/>
<origin>Kristianstad</origin>
<destination>Lund Malmö,Köpenhamn</destination>
<track>1B</track>
<train>1019</train>
<type>Öresundståg</type>
<comment></comment>
<detected>2010-09-04 17:40:41</detected>
<updated>2010-09-05 05:25:59</updated>
</transfer>
…
<transfer>
<id>114815</id>
<arrival>2010-09-05 17:38:00</arrival>
<newArrival/>
<departure/>
<newDeparture/>
<origin>Upplands Väsby,Uppsala,Tierp</origin>
<destination></destination>
<track>4</track>
<train>8442</train>
<type>Upptåget</type>
<comment></comment>
<detected>2010-09-05 05:40:33</detected>
<updated/>
</transfer>
</transfers>
</response>
Get transfer
GET /transfers/#{transfer_id}.{format}
Returnerar given transfer i givet format. Exempelsvar för /transfers/67.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<transfer>
<id>67</id>
<arrival>2010-08-06 20:01:00</arrival>
<newArrival>2010-08-06 20:08:00<newArrival/>
<departure>2010-08-06 20:01:00</departure>
<newDeparture>2010-08-06 20:08:00</newDeparture>
<origin>Tierp,Uppsala</origin>
<destination>Upplands Väsby</destination>
<track>2</track>
<train>8465</train>
<type>Upptåget</type>
<comment></comment>
<detected>2010-08-06 08:46:00</detected>
<updated/>
<station>9</station>
<changes>
<change>
<id>1273</id>
<arrival>2010-08-06 20:08:00</arrival>
<departure>2010-08-06 20:08:00</departure>
<track></track>
<type></type>
<comment></comment>
<detected>2010-08-06 19:53:24</detected>
</change>
…
<change>
<id>1413</id>
<arrival>2010-08-06 20:07:00</arrival>
<departure>2010-08-06 20:09:00</departure>
<track></track>
<type></type>
<comment></comment>
<detected>2010-08-06 20:10:39</detected>
</change>
</changes>
</transfer>
</response>
Get operators
GET /operators.{format}
Returnerar given operatör i givet format. Exempelsvar för /operators.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<operators>
<operator>
<id>1</id>
<name>SJ AB</name>
<url>http://www.sj.se/</url>
<phone>
<main>0771-75 75 75</main>
<support>0771-75 75 99</support>
<waif>08-501 255 90</waif>
<office>010-751 60 00</office>
</phone>
</operator>
…
<operator>
<id>11</id>
<name>Inlandsbanan</name>
<url>http://www.inlandsbanan.se/</url>
<phone>
<main>0771-53 53 53</main>
<support/>
<waif/>
<office>063- 19 44 00</office>
</phone>
</operator>
</operators>
</response>
Get operator
GET /operators/{operator_id}.{format}
Returnerar given operatör i givet format. Exempelsvar för /operators/1.xml:
<?xml version="1.0" encoding="utf-8"?>
<response>
<operator>
<id>1</id>
<name>SJ AB</name>
<url>http://www.sj.se/</url>
<phone>
<main>0771-75 75 75</main>
<support>0771-75 75 99</support>
<waif>08-501 255 90</waif>
<office>010-751 60 00</office>
</phone>
</operator>
</response>