Skip to content

Commit 7962598

Browse files
Update TI API for Consent Management - xcorrelator - Errors
- Added openId authentication for Consent Management - Aligment with guidelines: - added xcorrelator - aligned returned Errors
1 parent 32c7ca4 commit 7962598

File tree

1 file changed

+166
-41
lines changed

1 file changed

+166
-41
lines changed

code/API_definitions/Traffic Influence/Traffic_Influence.yaml

+166-41
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,6 @@ externalDocs:
9696
description: Product documentation at Camara
9797
url: https://github.com/camaraproject/
9898

99-
100-
############################################################################
101-
# Security #
102-
############################################################################
103-
security:
104-
- oAuth2:
105-
- 'edge:traffic-influences:read'
106-
- 'edge:traffic-influences:write'
107-
10899
############################################################################
109100
# Servers #
110101
############################################################################
@@ -135,7 +126,11 @@ tags:
135126
paths:
136127
/traffic-influences:
137128
get:
129+
security:
130+
- openId:
131+
- traffic-influences:read
138132
parameters:
133+
- $ref: '#/components/parameters/x-correlator'
139134
- in: query
140135
name: appId
141136
schema:
@@ -144,11 +139,14 @@ paths:
144139
tags:
145140
- Traffic Influence API read
146141
summary: Retries existing TrafficInfluence Resources
147-
description: Reads all of the active TrafficInfluence resources owned by the same API Consumer authenticated via oAuth2
142+
description: Reads all of the active TrafficInfluence resources owned by the same API Consumer
148143
operationId: getTrafficInfluence
149144
responses:
150145
'200':
151146
description: Returns the information about existing TrafficInfluence resources.
147+
headers:
148+
x-correlator:
149+
$ref: '#/components/headers/x-correlator'
152150
content:
153151
application/json:
154152
schema:
@@ -172,18 +170,24 @@ paths:
172170
summary: Creates a new TrafficInfluence resource
173171
description: Takes as input an object containing the intents from the API Consumer and creates a TrafficInfluence resourse accordingly. The trafficInfluenceID parameter, that is part of the object, must not be valorized when creating a new resource. For this reason the trafficInfluenceID parameter must be avoided in the object, anyway it will be ignored by the API Producer. It is automatically generated by the system and returned in the response.
174172
operationId: postTrafficInfluence
173+
parameters:
174+
- $ref: '#/components/parameters/x-correlator'
175+
security:
176+
- openId:
177+
- traffic-influences:write
175178
requestBody:
176179
description: Describes the request body
177180
required: true
178181
content:
179182
application/json:
180183
schema:
181184
$ref: '#/components/schemas/PostTrafficInfluence'
182-
183185
responses:
184186
'201':
185-
description: TrafficInfluence resource created, the related object is returned with the resource ID (trafficInfluenceID) and status (state) valorised,
187+
description: TrafficInfluence resource created, the related object is returned with the resource ID (trafficInfluenceID) and status (state) valorised.
186188
headers:
189+
x-correlator:
190+
$ref: '#/components/headers/x-correlator'
187191
Location:
188192
description: Link to the created traffic influence resource
189193
schema:
@@ -221,11 +225,19 @@ paths:
221225
tags:
222226
- Traffic Influence API read
223227
summary: Reads a specific TrafficInfluence resource identified by the trafficInfluenceID value
224-
description: Returns a specific TrafficInfluence resources owned by the same API Consumer authenticated via oAuth2
228+
description: Returns a specific TrafficInfluence resources owned by the same API Consumer
225229
operationId: getAllTrafficInfluences
230+
parameters:
231+
- $ref: '#/components/parameters/x-correlator'
232+
security:
233+
- openId:
234+
- traffic-influences:read
226235
responses:
227236
'200':
228237
description: OK.
238+
headers:
239+
x-correlator:
240+
$ref: '#/components/headers/x-correlator'
229241
content:
230242
application/json:
231243
schema:
@@ -248,6 +260,11 @@ paths:
248260
summary: updates a specific TrafficInfluence resource, identified by the trafficInfluenceID value
249261
description: The resource identified by the trafficInfluenceID value can be modified
250262
operationId: patchTrafficInfluence
263+
parameters:
264+
- $ref: '#/components/parameters/x-correlator'
265+
security:
266+
- openId:
267+
- traffic-influences:write
251268
requestBody:
252269
description: Describes the request body
253270
required: true
@@ -268,6 +285,8 @@ paths:
268285
schema:
269286
type: string
270287
description: Link to the created traffic influence resource
288+
x-correlator:
289+
$ref: '#/components/headers/x-correlator'
271290
"400":
272291
$ref: "#/components/responses/Generic400"
273292
'404':
@@ -291,7 +310,11 @@ paths:
291310
summary: Delete an existing TrafficInfluence resource
292311
description: invoked by the API Consumer to stop influencing the traffic, deleting a TrafficInfluence resource previously created
293312
operationId: deleteTrafficInfluence
313+
security:
314+
- openId:
315+
- traffic-influences:write
294316
parameters:
317+
- $ref: '#/components/parameters/x-correlator'
295318
- name: callbackUrl
296319
in: query
297320
required: false
@@ -318,18 +341,30 @@ paths:
318341
callbacks:
319342
onTrafficInfluenceChanged:
320343
$ref: "#/components/callbacks/onTrafficInfluenceChanged"
321-
344+
345+
#######################################################
346+
# COMPONENTS
347+
#######################################################
348+
322349
components:
323350
securitySchemes:
324-
oAuth2:
325-
type: oauth2
326-
description: This API uses OAuth 2 [More info](https://api.example.com/docs/auth)
327-
flows:
328-
clientCredentials:
329-
tokenUrl: 'https://example.com/oauth/token'
330-
scopes:
331-
'edge:traffic-influences:read': Grant read-only traffic-influences data
332-
'edge:traffic-influences:write': Grant write access to traffic-influences data
351+
openId:
352+
type: openIdConnect
353+
openIdConnectUrl: https://example.com/.well-known/openid-configuration
354+
355+
parameters:
356+
x-correlator:
357+
name: x-correlator
358+
in: header
359+
description: Correlation id for the different services
360+
schema:
361+
type: string
362+
363+
headers:
364+
x-correlator:
365+
description: Correlation id for the different services
366+
schema:
367+
type: string
333368

334369
#######################################################
335370
# EVENTS/CALLBACKS
@@ -344,7 +379,9 @@ components:
344379
- Traffic Influence CALLBACK Operation
345380
summary: Provides a notifican channel for changes in the TrafficInfluence resource
346381
description: Creating, modifying or delating a Traffic Influece resourece is an asycronous task. For this reason a notification channel via callback to a specified URL is provided.
347-
operationId: postTrafficInfluence
382+
operationId: postTrafficInfluence
383+
parameters:
384+
- $ref: '#/components/parameters/x-correlator'
348385
requestBody:
349386
description: subscription payload which contains the updated traffic influence instance
350387
content:
@@ -356,10 +393,16 @@ components:
356393
description: |
357394
Your server implementation should return this HTTP status code
358395
if the data was received successfully
396+
headers:
397+
x-correlator:
398+
$ref: '#/components/headers/x-correlator'
359399
'204':
360400
description: |
361401
Your server should return this HTTP status code if no longer interested
362402
in further updates
403+
headers:
404+
x-correlator:
405+
$ref: '#/components/headers/x-correlator'
363406
#######################################################
364407
# RESOURCES
365408
#######################################################
@@ -531,7 +574,7 @@ components:
531574
type: string
532575
example: OK
533576
ErrorInfo:
534-
description: Information in case of errors
577+
description: Information in case of error
535578
type: object
536579
required:
537580
- code
@@ -546,6 +589,9 @@ components:
546589
responses:
547590
ResNotFound:
548591
description: The specified resource was not found
592+
headers:
593+
x-correlator:
594+
$ref: '#/components/headers/x-correlator'
549595
content:
550596
application/json:
551597
schema:
@@ -555,6 +601,9 @@ components:
555601
message: Resource not found
556602
GenericError:
557603
description: An unknow error has occurred
604+
headers:
605+
x-correlator:
606+
$ref: '#/components/headers/x-correlator'
558607
content:
559608
application/json:
560609
schema:
@@ -564,6 +613,9 @@ components:
564613
message: Generic error
565614
BackendConnTimeout:
566615
description: Connection timeout towards backend service has occurred
616+
headers:
617+
x-correlator:
618+
$ref: '#/components/headers/x-correlator'
567619
content:
568620
application/json:
569621
schema:
@@ -573,44 +625,117 @@ components:
573625
message: Backend connection timeout
574626
OkDeletionInProgress:
575627
description: The resource delation request has been accepted
628+
headers:
629+
x-correlator:
630+
$ref: '#/components/headers/x-correlator'
576631
content:
577632
application/json:
633+
schema:
634+
$ref: '#/components/schemas/ErrResponse'
578635
example:
579636
status: OK
580637
message: Accepted
581638
Generic400:
582-
description: Invalid input
639+
description: Problem with the client request
640+
headers:
641+
x-correlator:
642+
$ref: '#/components/headers/x-correlator'
583643
content:
584644
application/json:
585645
schema:
586-
$ref: "#/components/schemas/ErrorInfo"
646+
$ref: '#/components/schemas/ErrorInfo'
587647
example:
588-
code: INVALID_INPUT
589-
message: "Schema validation failed at ..."
648+
status: 400
649+
code: INVALID_ARGUMENT
650+
message: Client specified an invalid argument, request body or query param
651+
590652
Generic401:
591-
description: Unauthorized
653+
description: Authentication problem with the client request
654+
headers:
655+
x-correlator:
656+
$ref: '#/components/headers/x-correlator'
592657
content:
593658
application/json:
594659
schema:
595-
$ref: "#/components/schemas/ErrorInfo"
660+
$ref: '#/components/schemas/ErrorInfo'
596661
example:
597-
code: UNAUTHORIZED
598-
message: "Authorization failed: ..."
662+
status: 401
663+
code: UNAUTHENTICATED
664+
message: Request not authenticated due to missing, invalid, or expired credentials
665+
599666
Generic403:
600-
description: Forbidden
667+
description: Client does not have sufficient permission
668+
headers:
669+
x-correlator:
670+
$ref: '#/components/headers/x-correlator'
671+
content:
672+
application/json:
673+
schema:
674+
$ref: '#/components/schemas/ErrorInfo'
675+
examples:
676+
PermissionDenied:
677+
value:
678+
status: 403
679+
code: PERMISSION_DENIED
680+
message: Client does not have sufficient permissions to perform this action
681+
InvalidTokenContext:
682+
value:
683+
status: 403
684+
code: INVALID_TOKEN_CONTEXT
685+
message: Phone number cannot be deducted from access token context
686+
687+
Generic404:
688+
description: The specified resource was not found
689+
headers:
690+
x-correlator:
691+
$ref: '#/components/headers/x-correlator'
692+
content:
693+
application/json:
694+
schema:
695+
$ref: '#/components/schemas/ErrorInfo'
696+
example:
697+
status: 404
698+
code: CALL_FORWARDING.UNKNOWN_PHONE_NUMBER
699+
message: Call forwarding check can't be done because the phone number is unknown
700+
701+
Generic500:
702+
description: Server error
703+
headers:
704+
x-correlator:
705+
$ref: '#/components/headers/x-correlator'
601706
content:
602707
application/json:
603708
schema:
604-
$ref: "#/components/schemas/ErrorInfo"
709+
$ref: '#/components/schemas/ErrorInfo'
605710
example:
606-
code: FORBIDDEN
607-
message: "Operation not allowed: ..."
711+
status: 500
712+
code: INTERNAL
713+
message: Server error
714+
608715
Generic503:
609-
description: Service unavailable
716+
description: Service unavailable. Typically the server is down
717+
headers:
718+
x-correlator:
719+
$ref: '#/components/headers/x-correlator'
720+
content:
721+
application/json:
722+
schema:
723+
$ref: '#/components/schemas/ErrorInfo'
724+
example:
725+
status: 503
726+
code: UNAVAILABLE
727+
message: Service unavailable
728+
729+
Generic504:
730+
description: Request time exceeded. If it happens repeatedly, consider reducing the request complexity
731+
headers:
732+
x-correlator:
733+
$ref: '#/components/headers/x-correlator'
610734
content:
611735
application/json:
612736
schema:
613-
$ref: "#/components/schemas/ErrorInfo"
737+
$ref: '#/components/schemas/ErrorInfo'
614738
example:
615-
code: SERVICE_UNAVALIBLE
616-
message: "Service unavailable"
739+
status: 504
740+
code: TIMEOUT
741+
message: Request timeout exceeded. Try later

0 commit comments

Comments
 (0)