Skip to content

Commit 8e49dc5

Browse files
authored
Merge pull request #6 from openTdataCH/AndreasAtSBB-patch-1
Update openapi.template.yaml - OJP1.0
2 parents 6b61892 + 6066d3c commit 8e49dc5

1 file changed

Lines changed: 101 additions & 29 deletions

File tree

‎openapi/ojp1.0/openapi.template.yaml‎

Lines changed: 101 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
openapi: "3.0.1"
1+
openapi: "3.0.3"
22
info:
3-
title: "Swiss OJP OpenAPI explorer"
4-
version: "1.0"
3+
title: "Swiss OJP 1.0 OpenAPI explorer"
4+
version: "1.1"
55
description: |
6-
This swagger introduces the list of provided services the Swiss OJP 1.0 and OJP 2.0 service. The interface follows the CEN standard interface OJP (Open API for distributed Journey Planning). For tests you need first to login with your key or this test key:
7-
8-
OJP 1.0:
9-
"${API_KEY}".
10-
11-
You can alter the different examples provided. Some parts are commented out. You make them valid again. Probably you will need to change the value to get a useful result (e.g. set it to the current date)
6+
This swagger introduces the list of provided services the Swiss OJP 1.0 service. The interface follows the CEN standard interface OJP (Open API for distributed Journey Planning).
7+
Keys for the API can be issued in our API manager https://api-manager.opentransportdata.swiss/.
8+
9+
You can alter the different examples provided. Some parts are commented out. You need to make them valid again, in order to get a useful response (e.g. set it to the current date or time).
1210
1311
We offer currently tests for the following services:
1412
- OJPLocationRequest: LIR
15-
- OJPTripRequest: TR
1613
- OJPStopEventRequest: SER
14+
- OJPTripRequest: TR
1715
- OJPTripInfoRequest: TIR
1816
externalDocs:
1917
description: "OJP documentation"
20-
url: "https://www.oev-info.ch/sites/default/files/2023-05/open_journey_planner_ojp_de_v1.pdf"
18+
url: https://transmodel-cen.eu/index.php/ojp/
2119
servers:
22-
- url: "https://api.opentransportdata.swiss"
20+
- url: https://api.opentransportdata.swiss
2321
components:
2422
securitySchemes:
2523
bearerAuth:
@@ -38,13 +36,13 @@ paths:
3836
required: true
3937
content:
4038
application/xml:
41-
schema:
42-
type: object
43-
xml:
44-
name: "OJP"
45-
wrapped: true
39+
schema:
40+
type: object
41+
xml:
42+
name: OJP
43+
wrapped: true
4644
examples:
47-
exampleA:
45+
exampleLIR:
4846
summary: "LIR - Simple"
4947
description: "Simple OJPLocationInformationtRequest for Bern"
5048
value: |
@@ -68,7 +66,7 @@ paths:
6866
</ServiceRequest>
6967
</OJPRequest>
7068
</OJP>
71-
exampleB:
69+
exampleSER:
7270
summary: "SER - Simple"
7371
description: "Simple OJPStopEventRequest for Bern"
7472
value: |
@@ -87,7 +85,7 @@ paths:
8785
<ojp:Text>Bern</ojp:Text>
8886
</ojp:LocationName>
8987
</ojp:PlaceRef>
90-
<!-- <ojp:DepArrTime>2024-06-01T12:43:50</ojp:DepArrTime> -->
88+
<!-- <ojp:DepArrTime>2024-06-01T12:43:50</ojp:DepArrTime> "set the time to request timetable at a certain time" -->
9189
</ojp:Location>
9290
<ojp:Params>
9391
<ojp:OperatorFilter>
@@ -104,21 +102,95 @@ paths:
104102
</ServiceRequest>
105103
</OJPRequest>
106104
</OJP>
105+
exampleTR:
106+
summary: "TR - Simple"
107+
description: "Simple OJPTripRequest"
108+
value: |
109+
<?xml version="1.0" encoding="UTF-8"?>
110+
<OJP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.siri.org.uk/siri" version="1.0" xmlns:ojp="http://www.vdv.de/ojp" xsi:schemaLocation="http://www.siri.org.uk/siri ../ojp-xsd-v1.0/OJP.xsd">
111+
<OJPRequest>
112+
<ServiceRequest>
113+
<RequestTimestamp>2025-09-09T14:45:04.318Z</RequestTimestamp>
114+
<RequestorRef>API-Explorer</RequestorRef>
115+
<ojp:OJPTripRequest>
116+
<RequestTimestamp>2025-09-09T14:45:04.318Z</RequestTimestamp>
117+
<MessageIdentifier>TR-1a1</MessageIdentifier>
118+
<ojp:Origin>
119+
<ojp:PlaceRef>
120+
<StopPointRef>8503308</StopPointRef>
121+
<ojp:LocationName>
122+
<ojp:Text>Kloten</ojp:Text>
123+
</ojp:LocationName>
124+
</ojp:PlaceRef>
125+
<ojp:DepArrTime>2025-12-12T11:00:00Z</ojp:DepArrTime>
126+
</ojp:Origin>
127+
<ojp:Destination>
128+
<ojp:PlaceRef>
129+
<StopPointRef>8503424</StopPointRef>
130+
<ojp:LocationName>
131+
<ojp:Text>Schaffhausen</ojp:Text>
132+
</ojp:LocationName>
133+
</ojp:PlaceRef>
134+
</ojp:Destination>
135+
<ojp:Params>
136+
<ojp:NumberOfResults>5</ojp:NumberOfResults>
137+
</ojp:Params>
138+
</ojp:OJPTripRequest>
139+
</ServiceRequest>
140+
</OJPRequest>
141+
</OJP>
142+
exampleTIR:
143+
summary: "TIR - Simple"
144+
description: "Simple OJPTripInformationRequest"
145+
value: |
146+
<?xml version="1.0" encoding="UTF-8"?>
147+
<OJP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.siri.org.uk/siri" version="1.0" xmlns:ojp="http://www.vdv.de/ojp" xsi:schemaLocation="http://www.siri.org.uk/siri ../ojp-xsd-v1.0/OJP.xsd">
148+
<OJPRequest>
149+
<ServiceRequest>
150+
<RequestTimestamp>2025-09-09T14:13:22.070Z</RequestTimestamp>
151+
<RequestorRef>API-Explorer</RequestorRef>
152+
<ojp:OJPTripInfoRequest>
153+
<RequestTimestamp>2025-09-09T14:13:22.070Z</RequestTimestamp>
154+
<MessageIdentifier>TIR-1a</MessageIdentifier>
155+
<ojp:JourneyRef>ch:1:sjyid:100001:18362-001</ojp:JourneyRef>
156+
<ojp:OperatingDayRef>2025-09-09</ojp:OperatingDayRef>
157+
<!-- <ojp:OperatingDayRef>{{today}}</ojp:OperatingDayRef> "Adapt the time" -->
158+
</ojp:OJPTripInfoRequest>
159+
</ServiceRequest>
160+
</OJPRequest>
161+
</OJP>
107162
responses:
108-
"401":
163+
'401':
109164
description: "Unauthorized"
110165
content:
111166
application/json:
112-
schema:
113-
type: object
114-
properties:
115-
error:
116-
type: string
117-
required:
118-
- error
167+
schema:
168+
type: object
169+
properties:
170+
error:
171+
type: string
172+
required:
173+
- error
119174
examples:
120175
exampleAX:
121176
summary: "Wrong or no key provided"
122177
description: "Get a correct key and apply it correctly."
123178
value:
124-
error: Authorization field missing
179+
error: "Authorization field missing"
180+
'429':
181+
description: "Rate limit exceeded"
182+
content:
183+
application/json:
184+
schema:
185+
type: object
186+
properties:
187+
error:
188+
type: string
189+
required:
190+
- error
191+
examples:
192+
exampleAY:
193+
summary: "Too many requests"
194+
description: "Wait some time till your key allows further requests or get a API key with a higher rate limit."
195+
value:
196+
error: "Rate limit exceeded"

0 commit comments

Comments
 (0)