-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.yml
302 lines (277 loc) · 7.97 KB
/
api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
swagger: '2.0'
info:
x-audience: external-partner
x-api-id: f4cffb37-949a-4ddd-be04-432a7e1dbecb
title: Tachograph File Archive
description: 'Access meta data about about stored tachograph files, download and upload tachograph files'
version: '1.1.5'
contact:
name: Team Compliant
email: [email protected]
x-zally-ignore: [172]
# SHOULD Prefer standard media type names - is ignored because application/zip is standard
# Zally only support json for the moment:
# https://github.com/zalando/zally/blob/master/server/src/main/java/de/zalando/zally/rule/zalando/MediaTypesRule.kt#L34
basePath: /api/tachograph-file-archive
host: api.iam.ccp-prod.net
schemes:
- https
securityDefinitions:
oauth2:
type: oauth2
tokenUrl: https://auth.iam.rio.cloud/oauth/token
flow: application
scopes:
tachograph-partner.read: Access right to read files and metadata from archive
tachograph-partner.write: Access right to upload files
paths:
/files:
get:
summary:
Get (paged) file informations or zip of files based on content-header.
Results are sorted by file-name ascending.
description: |
When sending Accept-Header='application/json' API will respond with a description in JSON for the files matching query parameters.
When sending Accept-Header='application/zip' API will respond with a compressed file in ZIP format containing all the tachograph files itself matching request paramters.
# Examples:
## Get all files
`GET /files`
## Get all files between two dates with paging information. `From` and `to` refering to FileMetadataModel::time_created.
`GET /files?from=2018-07-01T08%3A42%3A05.346Z&to=2018-05-28T08%3A42%3A05.346Z&offset=10&limit=10`
## Get Files from driver between two dates. `From` and `to` refering to FileMetadataModel::time_created.
`GET /files?file_type=driver&from=2018-07-01T08%3A42%3A05.346Z&to=2018-05-28T08%3A42%3A05.346Z`
## Get Files relating to specific driver with paging information
`GET /files?offset=0&limit=10&driver_id=7b290aff-6eab-47a3-9b61-e9f6c9dfc906`
consumes:
- text/plain; charset=utf-8
produces:
- application/json
- application/zip
parameters:
- $ref: '#/parameters/fleet-id'
- $ref: '#/parameters/driver-id'
- $ref: '#/parameters/equipment-id'
- $ref: '#/parameters/from'
- $ref: '#/parameters/to'
- $ref: '#/parameters/offset'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/file-type'
security:
- oauth2: [tachograph-partner.read]
responses:
200:
description: Success
schema:
$ref: '#/definitions/FileMetadataResponse'
post:
summary: 'Upload a file'
description: |
# Example:
## Upload a file
`POST /files?fleet_id=d304220d-430a-42fc-939a-b01c50ceef04&file_name=upload.ddd`
Body must contain file in binary format
consumes:
- 'application/octet-stream'
produces: []
parameters:
- $ref: '#/parameters/fleet-id-required'
- $ref: '#/parameters/file-name'
- $ref: '#/parameters/file-content'
security:
- oauth2: [tachograph-partner.write]
responses:
'201':
description: Success
/files/{file-id}:
get:
summary: Get a file itself or file metadata via file-id based on content-type header
description: |
# Example:
## Get file via file ID 148
`GET /files/148`
consumes:
- text/plain; charset=utf-8
produces:
- application/json
- application/octet-stream
parameters:
- $ref: '#/parameters/file-id'
security:
- oauth2: [tachograph-partner.read]
responses:
'200':
description: Success
schema:
$ref: '#/definitions/FileMetadataResponse'
parameters:
file-id:
name: file-id
in: path
description: 'File identification'
required: true
type: integer
format: int32
equipment-id:
name: equipment_id
in: query
description: 'Equipment identification'
required: false
type: string
driver-id:
name: driver_id
in: query
description: 'Driver identification'
required: false
type: string
fleet-id:
name: fleet_id
in: query
description: 'Fleet identification'
required: false
type: string
fleet-id-required:
name: fleet_id
in: query
description: 'Fleet identification'
required: true
type: string
from:
name: from
required: false
type: string
in: query
description: 'UTC value formatted as date-time (see: RFC 3339, section 5.6). Refering to FileMetadataModel::time_created.'
format: date-time
to:
name: to
required: false
in: query
type: string
description: 'UTC value formatted as date-time (see: RFC 3339, section 5.6). Refering to FileMetadataModel::time_created.'
format: date-time
offset:
name: offset
type: integer
format: int32
required: false
in: query
default: 0
description: 'Pagination: number of elements to skip'
limit:
name: limit
type: integer
format: int32
in: query
default: 10
maximum: 100
description: 'Pagination: number of elements on the page'
required: false
file-content:
in: body
name: file_content
description: 'The raw file'
required: true
schema:
type: string
format: byte
file-name:
name: file_name
in: query
required: true
type: string
description: 'Name of the file'
file-type:
name: file_type
in: query
type: string
description: defines the type of file
x-extensible-enum:
- unknown
- driver
- vehicle
- workshop
definitions:
FileMetadataResponse:
type: object
properties:
items:
type: array
items:
$ref: '#/definitions/FileMetadataModel'
count:
type: integer
format: int32
readOnly: true
total_count:
type: integer
format: int32
readOnly: true
pagination:
$ref: '#/definitions/PaginationModel'
FileMetadataModel:
type: object
properties:
reference_id:
type: string
format: uuid
description: In case of file_type driver this is the driverId, when file_type vehicle this is the vehicle id / asset id, for other cases this is empty
file_id:
type: integer
format: int32
description: File identification. Globally unique.
customer_id:
type: string
description: Customer id
file_name:
type: string
description: File name
size:
type: integer
format: int32
description: File size
file_type:
type: string
description: File type
x-extensible-enum:
- unknown
- driver
- vehicle
- workshop
has_sections_valid:
type: boolean
description: Has sections valid
is_corrupted:
type: boolean
description: Is corrupted
time_created:
type: string
format: date-time
description: 'UTC value formatted as date-time (see: RFC 3339, section 5.6)'
time_modified:
type: string
format: date-time
description: 'UTC value formatted as date-time (see: RFC 3339, section 5.6)'
created_by:
type: string
description: 'Created by'
modified_by:
type: string
description: 'Last modified by'
description: Tachograph File Metadata Response
PaginationModel:
type: object
properties:
offset:
type: integer
format: int32
readOnly: true
limit:
type: integer
format: int32
readOnly: true
previous:
type: string
readOnly: true
next:
type: string
readOnly: true