aboutsummaryrefslogtreecommitdiffstats
path: root/openapi/src/main/resources/api/api.yml
blob: 311d32a3be58302253cf17e05dd37065ea1b8f7d (plain)
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
openapi: 3.0.2
info:
  title: History API
  version: '1.0'
  description: API to provide actions for history
servers:
  - url: 'http://localhost:9002'
tags:
  - name: actions
paths:
  '/v1/actions/{userId}':
    parameters:
      - $ref: '#/components/parameters/userIdPathParam'
      - $ref: '#/components/parameters/xRequestIdHeader'
    get:
      summary: Retrieve all actions for a specific user
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionsListResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
      operationId: getActions
      parameters:
        - $ref: '#/components/parameters/pageQueryParam'
        - $ref: '#/components/parameters/pageSizeQueryParam'
        - schema:
            type: integer
            format: int32
          in: query
          name: showLastHours
          description: Get all actions within the last X hours.
      description: Get actions for the given userId
      tags:
        - actions
    post:
      summary: Create an action for a given user
      operationId: createAction
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateActionRequest'
        description: Only one action in each POST request
      description: Create a user action
      tags:
        - actions
    delete:
      summary: Delete user actions after given time
      operationId: deleteActions
      parameters:
        - schema:
            type: integer
            format: int32
          in: query
          name: deleteAfterHours
          description: If parameter is given actions older than value will be deleted for the user
          required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
      tags:
        - actions
      description: Delete user actions after given time
  /v1/actions:
    get:
      summary: Retrieve all actions from the portal with an optional timeframe
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionsListResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
      operationId: listActions
      parameters:
        - $ref: '#/components/parameters/xRequestIdHeader'
        - $ref: '#/components/parameters/pageQueryParam'
        - $ref: '#/components/parameters/pageSizeQueryParam'
        - schema:
            type: integer
            format: int32
          in: query
          name: showLastHours
          description: Get all actions within the last X hours.
      description: Get portal actions from all users
      tags:
        - actions
components:
  parameters:
    xRequestIdHeader:
      name: X-Request-Id
      in: header
      description: The unique identifier of the request
      required: true
      schema:
        type: string
    pageQueryParam:
      name: page
      in: query
      description: Page index (1..N)
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
        default: 1
    pageSizeQueryParam:
      name: pageSize
      in: query
      description: The size of the page to be returned
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 5000
        default: 10
    userIdPathParam:
      name: userId
      in: path
      description: User ID
      required: true
      schema:
        $ref: '#/components/schemas/ValidString'
  schemas:
    ActionResponse:
      title: ActionResponse
      type: object
      properties:
        actionCreatedAt:
          type: string
          format: date-time
        action:
          type: object
        saveInterval:
          type: integer
          format: int32
      required:
        - action
        - actionCreatedAt
    CreateActionRequest:
      title: CreateActionRequest
      type: object
      properties:
        userId:
          type: string
        actionCreatedAt:
          type: string
          format: date-time
        action:
          type: object
      required:
        - userId
        - actionCreatedAt
        - action
    ActionsListResponse:
      title: ActionsListResponse
      type: object
      properties:
        actionsList:
          type: array
          items:
            $ref: '#/components/schemas/ActionResponse'
        totalCount:
          type: integer
          format: int32
          description: Total number of items matching criteria
      required:
        - actionsList
        - totalCount
    Problem:
      type: object
      properties:
        type:
          type: string
          format: uri-reference
          description: |
            A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferencable and point to a human-readable documentation nor globally unique for the problem type.
          default: 'about:blank'
          example: /problem/connection-error
        title:
          type: string
          description: |
            A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
          example: Service Unavailable
        status:
          type: integer
          format: int32
          description: |
            The HTTP status code generated by the origin server for this occurrence of the problem.
          minimum: 100
          maximum: 600
          exclusiveMaximum: true
          example: 503
        detail:
          type: string
          description: |
            A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
          example: Connection to database timed out
        instance:
          type: string
          format: uri-reference
          description: |
            A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code.
          example: /problem/connection-error#token-info-read-timed-out
    ValidString:
      type: string
      pattern: '[\w,/!=§#@€:µ.*+?'' \-\u00C0-\u017F]*'
  responses:
    BadRequest:
      description: '400: Bad Request'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    Unauthorized:
      description: '401: Unauthorized'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    Forbidden:
      description: '403: Forbidden'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    NotFound:
      description: '404: Not Found'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    NotAllowed:
      description: '405: Method Not Allowed'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    Conflict:
      description: '409: Conflict'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    InternalServerError:
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response
    BadGateway:
      description: Bad Gateway
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
      headers:
        X-Request-Id:
          schema:
            type: string
          description: A <uuid4> in each response