Skip to content
Newer
Older
100644 880 lines (792 sloc) 31.9 KB
0217404 @fabian Transport API
fabian authored
1 <!doctype html>
2 <html>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
3
0217404 @fabian Transport API
fabian authored
4 <head>
5 <meta charset="utf-8">
6
7 <title>Transport API</title>
8
9 <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
10
11 <meta name="viewport" content="width=device-width, initial-scale=1" />
12
06fbce3 @fabian Updated Bootstrap
fabian authored
13 <link rel="stylesheet" href="media/bootstrap/css/bootstrap.min.css" />
0217404 @fabian Transport API
fabian authored
14 <link rel="stylesheet" href="media/css/layout.css" />
15 </head>
16
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
17 <body lang="en">
0217404 @fabian Transport API
fabian authored
18 <div class="wrapper">
19 <header>
20 <h1>Transport</h1>
21 <p>Swiss public transport API</p>
22 </header>
23
24 <article>
25 <h2>Introduction</h2>
26
be6f11a @fabian Added contact mail
fabian authored
27 <p>The Transport API allows interested developers to build their own applications using public timetable data, whether they're on the web, the desktop or mobile devices. Find out more about how you can start exploring the timetable data playground or just browse the API Documentation.</p>
28
29 <p>The source code can be found on <a href="https://github.com/OpendataCH/Transport">GitHub</a>, please ask any technical questions there. If you need a direct contact write a mail to <a href="mailto:transport@opendata.ch">transport@opendata.ch</a>.</p>
0217404 @fabian Transport API
fabian authored
30
966b4dc @fabian Renamed Playground to Examples
fabian authored
31 <h2 id="examples">Examples</h2>
78749fa @benoitpointet restyling of stationboard example
benoitpointet authored
32
33 <p>A few examples to show what can be produced with the Transport API:</p>
34 <ul>
35 <li>
f6b0b7e @fabian Moved examples
fabian authored
36 <a href="examples/stationboard.html">Stationboard table with autocompletion</a>
78749fa @benoitpointet restyling of stationboard example
benoitpointet authored
37 </li>
425217b @fabian Added connections search example
fabian authored
38 <li>
495e3a1 @fabian Fixed URL to connections search
fabian authored
39 <a href="examples/connections.php">Connections search</a>
425217b @fabian Added connections search example
fabian authored
40 </li>
78749fa @benoitpointet restyling of stationboard example
benoitpointet authored
41 </ul>
0217404 @fabian Transport API
fabian authored
42 <h2 id="documentation">API Documentation</h2>
43
d392b8b @fabian Added TOC
fabian authored
44 <ul>
45 <li>
46 <a href="#api-resources">Resources</a>
47 <ul>
54dbccc @fabian Documented nearby search
fabian authored
48 <li><a href="#locations">/locations</a></li>
d392b8b @fabian Added TOC
fabian authored
49 <li><a href="#connections">/connections</a></li>
50 <li><a href="#stationboard">/stationboard</a></li>
51 </ul>
52 </li>
53 <li>
54 <a href="#api-objects">Objects</a>
55 <ul>
56 <li><a href="#location">location</a></li>
57 <li><a href="#coordinates">coordinates</a></li>
58 <li><a href="#connection">connection</a></li>
59 <li><a href="#checkpoint">checkpoint</a></li>
60 <li><a href="#prognosis">prognosis</a></li>
6920ac5 @colinfrei Add link to stop object
colinfrei authored
61 <li><a href="#stop">stop</a></li>
d392b8b @fabian Added TOC
fabian authored
62 </ul>
63 </li>
b10fe54 @benib basic documentation for result limit
benib authored
64 <li>
65 <a href="#limit-response">Limit response</a>
66 </li>
d392b8b @fabian Added TOC
fabian authored
67 </ul>
68
69 <h3 id="api-resources">API Resources</h3>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
70
0217404 @fabian Transport API
fabian authored
71 <p>The Transport API builds on REST style resources which respond in JSON. Individual resources are detailed below.</p>
72
d392b8b @fabian Added TOC
fabian authored
73 <hr/>
0217404 @fabian Transport API
fabian authored
74
54dbccc @fabian Documented nearby search
fabian authored
75 <h3 id="locations">/locations</h3>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
76
77 <p>Returns the matching locations for the given parameters.</p>
78
79 <p>The locations in the response are scored to determine which is the most exact location.</p>
80
81 <p>This method can return a refine response, what means that the request has to be redone.</p>
82
83 <h4>Resource URL</h4>
84
85 <pre>http://transport.opendata.ch/v1/locations</pre>
86
87 <h4>Request Parameters</h4>
88
06fbce3 @fabian Updated Bootstrap
fabian authored
89 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
90 <thead>
91 <tr>
92 <th>Name</th>
93 <th>Required</th>
94 <th>Description</th>
95 <th>Example</th>
96 </tr>
97 </thead>
98 <tbody>
99 <tr>
100 <td><code>query</code></td>
101 <td>required</td>
102 <td>Specifies the location name to search for</td>
103 <td>Basel</td>
104 </tr>
105 <tr>
54dbccc @fabian Documented nearby search
fabian authored
106 <td><code>x</code></td>
107 <td>optional</td>
108 <td>Latitude</td>
109 <td>47.476001</td>
110 </tr>
111 <tr>
112 <td><code>y</code></td>
113 <td>optional</td>
114 <td>Longitude</td>
115 <td>8.306130</td>
116 </tr>
117 <tr>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
118 <td><code>type</code></td>
119 <td>optional</td>
120 <td>
121 Specifies the location type, possible types are:
122 <ul>
123 <li>all (default): Looks up for all types of locations</li>
124 <li>station: Looks up for stations (train station, bus station)</li>
125 <li>poi: Looks up for points of interest (Clock tower, China garden)</li>
126 <li>address: Looks up for an address (Zurich Bahnhofstrasse 33)</li>
127 </ul>
128 </td>
129 <td>address</td>
130 </tr>
131 </tbody>
132 </table>
133
134 <h4>Response parameters</h4>
135
06fbce3 @fabian Updated Bootstrap
fabian authored
136 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
137 <thead>
138 <tr>
139 <th>Name</th>
140 <th>Description</th>
141 </tr>
142 </thead>
143 <tbody>
144 <tr>
145 <td><code>stations</code></td>
146 <td>A list of <a href="#location">locations</a></td>
147 </tr>
148 </tbody>
149 </table>
150
151 <h4>Example Request</h4>
152
153 <pre>GET http://transport.opendata.ch/v1/locations?query=Basel</pre>
154
155 <h4>Example response</h4>
156
157 <pre>
0217404 @fabian Transport API
fabian authored
158 {
159 "stations": [
160 {
161 "coordinate": {
162 "type": "WGS84",
163 "x": "8540192",
164 "y": "47378177"
165 },
166 "id": "008503000",
167 "name": "Zuerich",
168 "score": "100"
169 },
170 {
171 "coordinate": {
172 "type": "WGS84",
173 "x": "8540192",
174 "y": "47378177"
175 },
176 "id": "008503000",
177 "name": "Zurich",
178 "score": "99"
179 }
180 ]
181 }
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
182 </pre>
183
184 <hr/>
185
186 <h3 id="connections">/connections</h3>
187
188 <p>Returns the next connections from a location to another.</p>
189
190 <h4>Resource URL</h4>
191
192 <pre>http://transport.opendata.ch/v1/connections</pre>
193
194 <h4>Request Parameters</h4>
195
06fbce3 @fabian Updated Bootstrap
fabian authored
196 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
197 <thead>
198 <tr>
199 <th>Name</th>
200 <th>Required</th>
201 <th>Description</th>
202 <th>Example</th>
203 </tr>
204 </thead>
205 <tbody>
206 <tr>
207 <td><code>from</code></td>
208 <td>required</td>
209 <td>Specifies the departure location of the connection</td>
210 <td>Lausanne</td>
211 </tr>
212 <tr>
213 <td><code>to</code></td>
214 <td>required</td>
215 <td>Specifies the arrival location of the connection</td>
216 <td>Genève</td>
217 </tr>
60a7e69 @colinfrei documentation for dateTime variable
colinfrei authored
218 <tr>
1290bdc @dbrgn Updated docs for via and limit. Fixes #27, documents #51.
dbrgn authored
219 <td><code>via</code></td>
220 <td>optional</td>
20fbdb3 @fabian Merge remote-tracking branch 'gwrtheyrn/via_docs'
fabian authored
221 <td class="description">Specifies up to five via locations. When specifying several vias, array notation (<code>via[]=via1&amp;via[]=via2</code>) is required.</td>
1290bdc @dbrgn Updated docs for via and limit. Fixes #27, documents #51.
dbrgn authored
222 <td>Bern</td>
223 </tr>
224 <tr>
1a510af @fabian Separated date and time in Connection Query
fabian authored
225 <td><code>date</code></td>
60a7e69 @colinfrei documentation for dateTime variable
colinfrei authored
226 <td>optional</td>
1a510af @fabian Separated date and time in Connection Query
fabian authored
227 <td>Date of the connection, in the format YYYY-MM-DD</td>
228 <td>2012-03-25</td>
229 </tr>
230 <tr>
231 <td><code>time</code></td>
232 <td>optional</td>
233 <td>Time of the connection, in the format hh:mm</td>
234 <td>17:30</td>
60a7e69 @colinfrei documentation for dateTime variable
colinfrei authored
235 </tr>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
236 <tr>
980d5cb @benib expose arrival/departure time parameter isArrivalTime, implements #66
benib authored
237 <td><code>isArrivalTime</code></td>
238 <td>optional</td>
239 <td>defaults to <code>0</code>, if set to <code>1</code> the passed <code>date</code> and <code>time</code> is the arrival time</td>
cb10b39 @fabian Documented page parameter
fabian authored
240 <td>1</td>
980d5cb @benib expose arrival/departure time parameter isArrivalTime, implements #66
benib authored
241 </tr>
242 <tr>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
243 <td><code>transportations</code></td>
244 <td>optional</td>
2bdb6db @rndstr small documentation corrections, css
rndstr authored
245 <td class="description">Transportation means; one or more of <code>ice_tgv_rj</code>, <code>ec_ic</code>, <code>ir</code>, <code>re_d</code>, <code>ship</code>, <code>s_sn_r</code>, <code>bus</code>, <code>cableway</code>, <code>arz_ext</code>, <code>tramway_underground</code></td>
cb10b39 @fabian Documented page parameter
fabian authored
246 <td>transportations[]=ec_ic&amp;transportations[]=bus</td>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
247 </tr>
248 <tr>
1290bdc @dbrgn Updated docs for via and limit. Fixes #27, documents #51.
dbrgn authored
249 <td><code>limit</code></td>
250 <td>optional</td>
251 <td>1 - 6. Specifies the number of connections to return. If several connections depart at the same time they are counted as 1.</td>
252 <td>Bern</td>
253 </tr>
20fbdb3 @fabian Merge remote-tracking branch 'gwrtheyrn/via_docs'
fabian authored
254 <tr>
cb10b39 @fabian Documented page parameter
fabian authored
255 <td><code>page</code></td>
256 <td>optional</td>
257 <td>0 - 10. Allows pagination of connections. Zero-based, so first page is&#160;0, second is&#160;1, third is&#160;2 and so on.</td>
258 <td>3</td>
259 </tr>
260 <tr>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
261 <td><code>direct</code></td>
262 <td>optional</td>
263 <td>defaults to 0, if set to 1 only direct connections are allowed</td>
264 <td>1</td>
265 </tr>
266 <tr>
267 <td><code>sleeper</code></td>
268 <td>optional</td>
269 <td>defaults to 0, if set to 1 only night trains containing beds are allowed, implies direct=1</td>
270 <td>1</td>
271 </tr>
272 <tr>
273 <td><code>couchette</code></td>
274 <td>optional</td>
275 <td>defaults to 0, if set to 1 only night trains containing couchettes are allowed, implies direct=1</td>
276 <td>1</td>
277 </tr>
278 <tr>
279 <td><code>bike</code></td>
280 <td>optional</td>
281 <td>defaults to 0, if set to 1 only trains allowing the transport of bicycles are allowed</td>
282 <td>1</td>
283 </tr>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
284 </tbody>
285 </table>
286
287 <h4>Response parameters</h4>
288
06fbce3 @fabian Updated Bootstrap
fabian authored
289 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
290 <thead>
291 <tr>
292 <th>Name</th>
293 <th>Description</th>
294 </tr>
295 </thead>
296 <tbody>
297 <tr>
298 <td><code>connections</code></td>
299 <td>A list of <a href="#connection">connections</a></td>
300 </tr>
301 </tbody>
302 </table>
303
304 <h4>Example Requests</h4>
305
306 <pre>GET http://transport.opendata.ch/v1/connections?from=Lausanne&amp;to=Genève</pre>
ac44aa0 @fabian Replaced aka
fabian authored
307 <p>which is the same as</p>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
308 <pre>GET http://transport.opendata.ch/v1/connections?from=008501120&amp;to=008501008</pre>
309
310 <h4>Example response</h4>
311
312 <pre>
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
313 {
314 "connections" : [
315 {
316 "from" : {
317 "arrival" : null,
2966cb5 @rndstr fix documentation for issue #20
rndstr authored
318 "departure" : "2012-03-31T08:58:00+02:00",
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
319 "platform" : "7",
320 "prognosis" : {
321 "platform" : null,
224b648 @dol Enhancement: Replaced date parsing with \DateTime and changed the pro…
dol authored
322 "arrival" : null
05e91a8 @dol Minor enhancement: Updated api documentation (stationboard)
dol authored
323 "departure" : null
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
324 "capacity1st" : "-1",
325 "capacity2nd" : "-1",
326 },
327 "station" : {
328 "coordinate" : {
329 "type" : "WGS84",
330 "x" : "6629086",
331 "y" : "46516785"
332 },
333 "id" : "008501120",
334 "name" : "Lausanne",
335 "score" : null
336 }
337 },
338 "to" : {
2966cb5 @rndstr fix documentation for issue #20
rndstr authored
339 "arrival" : "2012-03-31T09:46:00+02:00",
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
340 "departure" : null,
341 "platform" : "2",
342 "prognosis" : {
343 "platform" : null,
05e91a8 @dol Minor enhancement: Updated api documentation (stationboard)
dol authored
344 "arrival" : null,
224b648 @dol Enhancement: Replaced date parsing with \DateTime and changed the pro…
dol authored
345 "departure" : null
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
346 "capacity1st" : null,
347 "capacity2nd" : null,
348 },
349 "station" : {
350 "coordinate" : {
351 "type" : "WGS84",
352 "x" : "6142437",
353 "y" : "46210217"
354 },
355 "id" : "008501008",
356 "name" : "Genève",
357 "score" : null
358 }
359 }
360 },
361 ],
362 // ...
363 }
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
364 </pre>
365 <hr/>
366
367 <h3 id="stationboard">/stationboard</h3>
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
368
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
369 <p>Returns the next connections leaving from a specific location.</p>
370
371 <h4>Resource URL</h4>
372
373 <pre>http://transport.opendata.ch/v1/stationboard</pre>
374
375 <h4>Request Parameters</h4>
376
06fbce3 @fabian Updated Bootstrap
fabian authored
377 <table class="table table-bordered">
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
378 <thead>
379 <tr>
380 <th>Name</th>
381 <th>Required</th>
382 <th>Description</th>
383 <th>Example</th>
384 </tr>
385 </thead>
386 <tbody>
387 <tr>
388 <td><code>station</code></td>
389 <td>required</td>
390 <td>Specifies the location of which a stationboard should be returned</td>
391 <td>Aarau</td>
392 </tr>
393 <tr>
394 <td><code>id</code></td>
395 <td>optional</td>
2bdb6db @rndstr small documentation corrections, css
rndstr authored
396 <td>The id of the station whose stationboard should be returned.
397 <br />Alternative to the station parameter; one of these two is required.
398 <br />If both an id and a station are specified the id has precedence.
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
399 </td>
400 <td>8503059 <em>(for Zurich Stadelhofen)</em></td>
401 </tr>
402 <tr>
403 <td><code>limit</code></td>
404 <td>optional</td>
8a6b38e @colinfrei documentation update on stationboard limit
colinfrei authored
405 <td>Number of departing connections to return.
406 <br />This is not a hard limit - if multiple connections leave at the same time it'll return any connections that leave at the same time as the last connection within the limit.<br />
407 For example: limit=4 will return connections leaving at :
c60248a @colinfrei don't overdo it
colinfrei authored
408 <ul><li>19:30</li><li>19:32</li><li>19:32</li><li>19:35</li><li>19:35</li></ul>
8a6b38e @colinfrei documentation update on stationboard limit
colinfrei authored
409 Because one of the connections leaving at 19:35 is within the limit, all connections leaving at 19:35 are shown.
410 </td>
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
411 <td>15</td>
412 </tr>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
413 <tr>
414 <td><code>transportations</code></td>
415 <td>optional</td>
2bdb6db @rndstr small documentation corrections, css
rndstr authored
416 <td class="description">Transportation means; one or more of <code>ice_tgv_rj</code>, <code>ec_ic</code>, <code>ir</code>, <code>re_d</code>, <code>ship</code>, <code>s_sn_r</code>, <code>bus</code>, <code>cableway</code>, <code>arz_ext</code>, <code>tramway_underground</code></td>
b41da22 @benib add documentation, fixes #41 and #47
benib authored
417 <td>?transportations[]=ec_ic&amp;transportations[]=bus</td>
418 </tr>
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
419 </tbody>
420 </table>
421
422 <h4>Response parameters</h4>
423
06fbce3 @fabian Updated Bootstrap
fabian authored
424 <table class="table table-bordered">
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
425 <thead>
426 <tr>
427 <th>Name</th>
428 <th>Description</th>
429 </tr>
430 </thead>
431 <tbody>
432 <tr>
433 <td><code>stationboard</code></td>
434 <td>A list of <a href="#stop">stops</a>, showing the last stop of the line leaving that station.</td>
435 </tr>
436 </tbody>
437 </table>
438
439 <h4>Example Requests</h4>
440
6a36f05 @fabian Fixed &amp;
fabian authored
441 <pre>GET http://transport.opendata.ch/v1/stationboard?station=Aarau&amp;limit=10</pre>
ac44aa0 @fabian Replaced aka
fabian authored
442 <p>which is the same as</p>
6a36f05 @fabian Fixed &amp;
fabian authored
443 <pre>GET http://transport.opendata.ch/v1/stationboard?id=008502113&amp;limit=10</pre>
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
444
445 <h4>Example response</h4>
446
447 <pre>
448 {
449 "stationboard" : [
450 {
451 "stop":
452 {
453 "station":
454 {
455 "id": "8502996",
456 "name": "Aarau, Bahnhof",
457 "score": null,
458 "coordinate":
459 {
460 "type" : "WGS84",
461 "x": "8050864",
462 "y": "47392020"
463 }
464 },
465 "arrival": null,
2966cb5 @rndstr fix documentation for issue #20
rndstr authored
466 "departure": "2012-03-31T14:39:00+02:00",
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
467 "platform": "",
468 "prognosis":
469 {
470 "platform": null,
05e91a8 @dol Minor enhancement: Updated api documentation (stationboard)
dol authored
471 "arrival": null,
472 "departure": null,
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
473 "capacity1st": "-1",
474 "capacity2nd": "-1"
475 }
476 },
477 "name": "BUS13543",
478 "category": "BUS",
479 "number": "13543",
480 "operator": null,
481 "to": "Frick, Bahnhof"
482 },{
483 "stop":
484 {
485 "station":
486 {
487 "id": "8502996",
488 "name": "Aarau, Bahnhof",
489 "score": null,
490 "coordinate":
491 {
492 "type": "WGS84",
493 "x": "8050864",
494 "y": "47392020"
495 }
496 },
497 "arrival": null,
2966cb5 @rndstr fix documentation for issue #20
rndstr authored
498 "departure": "2012-03-31T14:39:00+02:00",
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
499 "platform": "",
500 "prognosis":
501 {
502 "platform": null,
05e91a8 @dol Minor enhancement: Updated api documentation (stationboard)
dol authored
503 "arrival": null,
504 "departure": null,
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
505 "capacity1st": "-1",
506 "capacity2nd": "-1"
507 }
508 },
509 "name": "Bus 2",
510 "category": "Bus",
511 "number": "2",
512 "operator": "BBA",
513 "to": "Aarau Rohr, Unterdorf"
514 },
515 // ...
516 ]
517 }
518 </pre>
b4183fa @benoitpointet removed tabbed navigation, completed stations and connections documen…
benoitpointet authored
519
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
520 <hr/>
521
d392b8b @fabian Added TOC
fabian authored
522 <h3 id="api-objects">API Objects</h3>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
523
524 <p>API responses are composites of the following objects:</p>
525
526 <h4 id="location">Location Object</h4>
527
06fbce3 @fabian Updated Bootstrap
fabian authored
528 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
529 <thead>
530 <tr>
531 <th>Name</th>
532 <th>Description</th>
533 </tr>
534 </thead>
535 <tbody>
536 <tr>
537 <td><code>id</code></td>
538 <td>The id of the location</td>
539 </tr>
540 <tr>
541 <td><code>type</code></td>
542 <td>
543 Type of the location, can contain:
544 <ul>
545 <li>station: Location is a train station, bus station</li>
546 <li>poi: Location is a point of interest (Clock tower, China garden)</li>
547 <li>address: Location is an address</li>
548 <li>refine: Location is not defined, the user has to relocate</li>
549 </ul>
550 </td>
551 </tr>
552 <tr>
553 <td><code>name</code></td>
554 <td>The location name</td>
555 </tr>
556 <tr>
557 <td><code>score</code></td>
696a351 @fabian Documentation fixes
fabian authored
558 <td>The accuracy of the result</td>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
559 </tr>
560 <tr>
561 <td><code>coordinates</code></td>
562 <td>The location <a href="#coordinates">coordinates</a></td>
563 </tr>
81923a6 @fabian Added documentation for distance
fabian authored
564 <tr>
565 <td><code>distance</code></td>
566 <td>If search has been with coordinates, distance to original point in meters</td>
567 </tr>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
568 </tbody>
569 </table>
570
571 <h4 id="coordinates">Coordinates Object</h4>
572
06fbce3 @fabian Updated Bootstrap
fabian authored
573 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
574 <thead>
575 <tr>
576 <th>Name</th>
577 <th>Description</th>
578 </tr>
579 </thead>
580 <tbody>
581 <tr>
582 <td><code>type</code></td>
583 <td>The type of the given coordinate</td>
584 </tr>
585 <tr>
586 <td><code>x</code></td>
587 <td>Latitude</td>
588 </tr>
589 <tr>
590 <td><code>y</code></td>
591 <td>Longitude</td>
592 </tr>
593 </tbody>
594 </table>
595
596 <h4 id="connection">Connection Object</h4>
597
598 <p>A connection represents a possible journey between two locations.</p>
599
06fbce3 @fabian Updated Bootstrap
fabian authored
600 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
601 <thead>
602 <tr>
603 <th>Name</th>
604 <th>Description</th>
605 <th>Example</th>
606 </tr>
607 </thead>
608 <tbody>
609 <tr>
610 <td><code>from</code></td>
611 <td colspan="2">The departure <a href="#checkpoint"> checkpoint</a> of the connection</td>
612 </tr>
613 <tr>
78749fa @benoitpointet restyling of stationboard example
benoitpointet authored
614 <td><code>to</code></td>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
615 <td colspan="2">The arrival <a href="#checkpoint"> checkpoint</a> of the connection</td>
616 </tr>
9da3d6d @fabian Updated documentation
fabian authored
617 <tr>
618 <td><code>duration</code></td>
619 <td>Duration of the journey</td>
620 <td>00d00:43:00</td>
621 </tr>
622 <tr>
623 <td><code>service</code></td>
624 <td colspan="2"><a href="#service">Service</a> information about how regular the connection operates</td>
625 </tr>
626 <tr>
627 <td><code>products</code></td>
628 <td>Array with transport products</td>
629 <td>IR, S9</td>
630 </tr>
631 <tr>
632 <td><code>capacity1st</code></td>
633 <td>The maximum estimated occupation load of 1st class coaches</td>
634 <td>1</td>
635 </tr>
636 <tr>
637 <td><code>capacity2st</code></td>
638 <td>The maximum estimated occupation load of 2nd class coaches</td>
639 <td>2</td>
640 </tr>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
641 </tbody>
642 </table>
643
644 <h4 id="checkpoint">Checkpoint Object</h4>
645
78749fa @benoitpointet restyling of stationboard example
benoitpointet authored
646 <p>A checkpoint represents an arrival or a departure point (in time and space) of a connection.</p>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
647
06fbce3 @fabian Updated Bootstrap
fabian authored
648 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
649 <thead>
650 <tr>
651 <th>Name</th>
652 <th>Description</th>
653 <th>Example</th>
654 </tr>
655 </thead>
656 <tbody>
657 <tr>
658 <td><code>station</code></td>
659 <td colspan="2">The <a href="#location">location</a> of the checkpoint</td>
660 </tr>
661 <tr>
662 <td><code>arrival</code></td>
663 <td>The arrival time to the checkpoint</td>
664 <td>14:58:00</td>
665 </tr>
666 <tr>
667 <td><code>departure</code></td>
668 <td>The departure time from the checkpoint</td>
669 <td>null</td>
670 </tr>
671 <tr>
672 <td><code>platform</code></td>
673 <td>The arrival/departure platform </td>
674 <td>8</td>
675 </tr>
676 <tr>
677 <td><code>prognosis</code></td>
678 <td colspan="2">The checkpoint <a href="#prognosis">prognosis</a></td>
679 </tr>
680 </tbody>
681 </table>
682
9da3d6d @fabian Updated documentation
fabian authored
683 <h4 id="service">Service Object</h4>
684
685 <p>Operation information for a connection.</p>
686
06fbce3 @fabian Updated Bootstrap
fabian authored
687 <table class="table table-bordered">
9da3d6d @fabian Updated documentation
fabian authored
688 <thead>
689 <tr>
690 <th>Name</th>
691 <th>Description</th>
692 <th>Example</th>
693 </tr>
694 </thead>
695 <tbody>
696 <tr>
697 <td><code>regular</code></td>
698 <td>Information about how regular a connection operates.</td>
699 <td>daily</td>
700 </tr>
701 <tr>
702 <td><code>irregular</code></td>
703 <td>Additional information about irregular operation dates.</td>
704 <td>not 23., 24. Jun 2012</td>
705 </tr>
706 </tbody>
707 </table>
708
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
709 <h4 id="prognosis">Prognosis Object</h4>
710
711 <p>A prognosis contains "realtime" informations on the status of a connection checkpoint.</p>
712
06fbce3 @fabian Updated Bootstrap
fabian authored
713 <table class="table table-bordered">
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
714 <thead>
715 <tr>
716 <th>Name</th>
717 <th>Description</th>
718 <th>Example</th>
719 </tr>
720 </thead>
721 <tbody>
722 <tr>
723 <td><code>platform</code></td>
724 <td>The estimated arrival/departure platform</td>
725 <td>8</td>
726 </tr>
727 <tr>
224b648 @dol Enhancement: Replaced date parsing with \DateTime and changed the pro…
dol authored
728 <td><code>departure</code></td>
729 <td>The departure time prognosis to the checkpoint<br>Date format: <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a></td>
730 <td>2012-03-31T08:58:00+02:00</td>
731 </tr>
732 <tr>
733 <td><code>arrival</code></td>
734 <td>The arrival time prognosis to the checkpoint<br>Date format: <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a></td>
735 <td>2012-03-31T09:35:00+02:00</td>
d521327 @benoitpointet some more doc refactoring
benoitpointet authored
736 </tr>
737 <tr>
738 <td><code>capacity1st</code></td>
739 <td>The estimated occupation load of 1st class coaches</td>
740 <td>1</td>
741 </tr>
742 <tr>
743 <td><code>capacity2st</code></td>
744 <td>The estimated occupation load of 2nd class coaches</td>
745 <td>2</td>
746 </tr>
747 </tbody>
748 </table>
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
749
750 <h4 id="stop">Stop Object</h4>
751
06fbce3 @fabian Updated Bootstrap
fabian authored
752 <table class="table table-bordered">
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
753 <thead>
754 <tr>
755 <th>Name</th>
756 <th>Description</th>
757 <th>Example</th>
758 </tr>
759 </thead>
760 <tbody>
761 <tr>
762 <td><code>station</code></td>
763 <td colspan="2">A <a href="#location">location</a> object showing this line's stop at the requested station.</td>
764 </tr>
765 <tr>
766 <td><code>name</code></td>
767 <td>The name of the connection</td>
768 <td>Bus 2</td>
769 </tr>
770 <tr>
771 <td><code>category</code></td>
772 <td>The type of connection this is</td>
773 <td>Bus</td>
774 </tr>
775 <tr>
776 <td><code>number</code></td>
777 <td>The number of the connection's line, e.g. Bus line 2</td>
778 <td>2</td>
779 </tr>
780 <tr>
781 <td><code>operator</code></td>
782 <td>The operator of the connection's line</td>
783 <td>BBA</td>
784 </tr>
785 <tr>
786 <td><code>to</code></td>
787 <td>The final destination of this line</td>
788 <td>Aarau Rohr, Unterdorf</td>
789 </tr>
790 </tbody>
791 </table>
b10fe54 @benib basic documentation for result limit
benib authored
792
793 <h3 id="limit-response">Limit response</h3>
794 <p>You can limit the response data with the <code>fields</code> parameter.
ebe170d @fabian Replaced ResultLimit with Normalizer\FieldNormalizer
fabian authored
795 If any <code>fields[]</code> is passed, only the specified fields are in the response.
b10fe54 @benib basic documentation for result limit
benib authored
796 The API is aware of the hierarchy, if you set a field, everything below is in the response unless a more specific (further down in the hierarchy) field is set.
797 </p>
798 <h4>Example Request</h4>
799
ebe170d @fabian Replaced ResultLimit with Normalizer\FieldNormalizer
fabian authored
800 <pre>GET http://transport.opendata.ch/v1/connections?from=Lausanne&amp;to=Genève&amp;fields[]=connections/from/departure&amp;fields[]=connections/to/arrival</pre>
b10fe54 @benib basic documentation for result limit
benib authored
801
802 <h4>Example response</h4>
803
804 <pre>
805 {
806 "connections":[
807 {
808 "from":{
809 "departure":"2012-05-01T19:42:00+0200",
810 },
811 "to":{
812 "arrival":"2012-05-01T20:15:00+0200",
ebe170d @fabian Replaced ResultLimit with Normalizer\FieldNormalizer
fabian authored
813 }
b10fe54 @benib basic documentation for result limit
benib authored
814 },
815 ],
816 //....
817 }
818
819 </pre>
820
821
822 <h4>Example Request</h4>
823
ebe170d @fabian Replaced ResultLimit with Normalizer\FieldNormalizer
fabian authored
824 <pre>GET http://transport.opendata.ch/v1/connections?from=Lausanne&amp;to=Genève&amp;fields[]=connections/from&amp;fields[]=connections/to/station</pre>
646ba16 @colinfrei Documentation of the stationboard call
colinfrei authored
825
b10fe54 @benib basic documentation for result limit
benib authored
826 <h4>Example response</h4>
827
828 <pre>
829
830 {
831 "connections":[
832 {
833 "from":{
834 "station":{
835 "id":"008501120",
836 "name":"Lausanne",
837 "score":null,
838 "coordinate":{
839 "type":"WGS84",
840 "x":6.629086,
841 "y":46.516785
842 }
843 },
844 "arrival":null,
845 "departure":"2012-05-01T19:42:00+0200",
846 "platform":"5",
847 "prognosis":{
848 "platform":null,
849 "arrival":null,
850 "departure":null,
851 "capacity1st":"1",
852 "capacity2nd":"1"
853 }
854 },
855 "to":{
856 "station":{
857 "id":"008501008",
858 "name":"Gen\u00e8ve",
859 "score":null,
860 "coordinate":{
861 "type":"WGS84",
862 "x":6.142437,
863 "y":46.210217
864 }
2dbcb85 @fabian Fixed fields documentation
fabian authored
865 }
ebe170d @fabian Replaced ResultLimit with Normalizer\FieldNormalizer
fabian authored
866 }
b10fe54 @benib basic documentation for result limit
benib authored
867 },
868 ],
869 // ...
870 }
871 </pre>
0217404 @fabian Transport API
fabian authored
872 </article>
873
874 <footer>
875 <p>Powered by <a href="http://opendata.ch/">Opendata.ch</a></p>
876 </footer>
877 </div>
878 </body>
879 </html>
Something went wrong with that request. Please try again.