Skip to content

Commit 756a098

Browse files
Merge pull request #6036 from sadilchamishka/improve-user-managent-workflow-docs
Improve workflows, outbound provisioning docs
2 parents 3902642 + ae21bfb commit 756a098

31 files changed

+751
-529
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
template: templates/redoc.html
3+
---
4+
5+
<redoc spec-url="{{base_path}}/apis/restapis/approvals.yaml" theme='{{redoc_theme}}'></redoc>
Lines changed: 377 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,377 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Asgardeo - Workflow Approval API
4+
description: |
5+
This is the RESTful API for a user to manage pending approvals in Asgardeo. This API can be used to retrieve pending approvals and update the status of the approval tasks for the authenticated user.
6+
version: v2
7+
servers:
8+
- url: 'https://api.asgardeo.io/t/{organization-name}/api/users/v2'
9+
security:
10+
- OAuth2: []
11+
tags:
12+
- name: me
13+
description: Operations for the authenticated user.
14+
paths:
15+
/me/approval-tasks:
16+
get:
17+
tags:
18+
- me
19+
summary: Retrieves available approvals for the authenticated user
20+
description: |
21+
Retrieve the available approval tasks in the system for the authenticated user. This API returns the following types of approvals:
22+
* READY - Tasks that are _claimable_ by the user. If a particular task is in the READY state, the user is eligible to self-assign the task and complete it.
23+
* RESERVED - Tasks that are _assigned_ to the user and to be approved by this user.
24+
* COMPLETED - Tasks that are already _completed_ (approved or denied) by this user.
25+
26+
A user can also invoke the endpoint with the following query parameters.
27+
security:
28+
- OAuth2:
29+
- internal_approval_task_view
30+
operationId: listApprovalTasksForLoggedInUser
31+
parameters:
32+
- $ref: '#/components/parameters/limitQueryParam'
33+
- $ref: '#/components/parameters/offsetQueryParam'
34+
- $ref: '#/components/parameters/statusQueryParam'
35+
responses:
36+
"200":
37+
description: Array of approval tasks matching the search criteria
38+
content:
39+
'application/json':
40+
schema:
41+
type: array
42+
items:
43+
$ref: '#/components/schemas/TaskSummary'
44+
example:
45+
- id: "453"
46+
name: "Sample Task 1"
47+
presentationSubject: Update Claims
48+
presentationName: SampleWorkflowTask
49+
taskType: TASK
50+
status: RESERVED
51+
priority: 0
52+
createdTimeInMillis: "1565597712157"
53+
- id: "452"
54+
name: "Sample Task 2"
55+
presentationSubject: Update Claims
56+
presentationName: SampleWorkflowTask
57+
taskType: TASK
58+
status: COMPLETED
59+
priority: 0
60+
createdTimeInMillis: "1565597675414"
61+
- id: "451"
62+
name: "Sample task 3"
63+
presentationSubject: Update Claims
64+
presentationName: SampleWorkflowTask
65+
taskType: TASK
66+
status: READY
67+
priority: 0
68+
createdTimeInMillis: "1565597569021"
69+
400:
70+
$ref: '#/components/responses/InvalidInput'
71+
401:
72+
$ref: '#/components/responses/Unauthorized'
73+
403:
74+
$ref: '#/components/responses/Forbidden'
75+
500:
76+
$ref: '#/components/responses/ServerError'
77+
/me/approval-tasks/{task-id}:
78+
get:
79+
tags:
80+
- me
81+
summary: Retrieves an approval task by the task-id
82+
description: |
83+
Retrieves information of a specific approval task identified by the task-id
84+
85+
security:
86+
- OAuth2:
87+
- internal_approval_task_view
88+
operationId: getApprovalTaskInfo
89+
parameters:
90+
- $ref: '#/components/parameters/taskIdPathParam'
91+
responses:
92+
"200":
93+
description: Detailed information of the approval task identified by the
94+
task-id
95+
content:
96+
'application/json':
97+
schema:
98+
$ref: '#/components/schemas/TaskData'
99+
example:
100+
id: "452"
101+
subject: Update Claims
102+
description: You have a request to approve claim update action of
103+
a user.
104+
priority: 0
105+
initiator: admin
106+
approvalStatus: APPROVE
107+
assignees:
108+
- key: group
109+
value: admin
110+
properties:
111+
- key: REQUEST ID
112+
value: "34172334-fccb-4ef4-9830-08c3caeaab9e,"
113+
- key: Username
114+
value: "aysh234,"
115+
- key: User Store Domain
116+
value: "PRIMARY,"
117+
- key: Profile
118+
value: "default,"
119+
- key: Claims
120+
value: "http://wso2.org/claims/organization:,http://wso2.org/claims/telephone:,http://wso2.org/claims/im:,http://wso2.org/claims/country:Sri\
121+
\ Lanka,http://wso2.org/claims/mobile:,http://wso2.org/claims/emailaddress:ayesha@wso2.com,profileConfiguration:default,http://wso2.org/claims/lastname:Dissanayaka,http://wso2.org/claims/url:,http://wso2.org/claims/givenname:Ayesha,"
122+
400:
123+
$ref: '#/components/responses/InvalidInput'
124+
401:
125+
$ref: '#/components/responses/Unauthorized'
126+
403:
127+
$ref: '#/components/responses/Forbidden'
128+
404:
129+
$ref: '#/components/responses/NotFound'
130+
409:
131+
$ref: '#/components/responses/Conflict'
132+
500:
133+
$ref: '#/components/responses/ServerError'
134+
/me/approval-tasks/{task-id}/state:
135+
put:
136+
tags:
137+
- me
138+
summary: Changes the state of an approval task
139+
description: |
140+
Update the approval task status by defining one of the following actions:
141+
* CLAIM - Reserve the task for the user. Status of the task will be changed from READY to RESERVED.
142+
* RELEASE - Release the task for other users to claim. Status of the task will be changed from RESERVED to READY.
143+
* APPROVE - Approve the task. Status of the task will be changed to COMPLETED.
144+
* REJECT - Deny the task. Status of the task will be changed to COMPLETED.
145+
146+
security:
147+
- OAuth2:
148+
- internal_approval_task_update
149+
operationId: updateStateOfTask
150+
parameters:
151+
- $ref: '#/components/parameters/taskIdPathParam'
152+
requestBody:
153+
description: To which state the task should be changed.
154+
content:
155+
'application/json':
156+
schema:
157+
$ref: '#/components/schemas/StateDTO'
158+
required: false
159+
responses:
160+
200:
161+
$ref: '#/components/responses/OK'
162+
400:
163+
$ref: '#/components/responses/InvalidInput'
164+
401:
165+
$ref: '#/components/responses/Unauthorized'
166+
403:
167+
$ref: '#/components/responses/Forbidden'
168+
404:
169+
$ref: '#/components/responses/NotFound'
170+
500:
171+
$ref: '#/components/responses/ServerError'
172+
components:
173+
schemas:
174+
TaskSummary:
175+
type: object
176+
properties:
177+
id:
178+
type: string
179+
description: Unique ID to represent an Approval Task
180+
example: "451"
181+
name:
182+
type: string
183+
description: Unique name for the Approval Task
184+
example: s367:testTask
185+
presentationSubject:
186+
type: string
187+
description: Display value for Approval Operation
188+
example: Add new Role
189+
presentationName:
190+
type: string
191+
description: Display value for Approval Task
192+
example: sampleTask
193+
taskType:
194+
type: string
195+
description: Type of the Approval
196+
example: TASK
197+
status:
198+
type: string
199+
description: State of the Approval task
200+
example: READY
201+
enum:
202+
- READY
203+
- RESERVED
204+
- COMPLETED
205+
priority:
206+
type: integer
207+
description: Priority of the Approval task
208+
example: 0
209+
createdTimeInMillis:
210+
type: string
211+
description: The time that the operation for approval initiated
212+
example: "1565597569021"
213+
TaskData:
214+
type: object
215+
properties:
216+
id:
217+
type: string
218+
description: Unique ID to represent a approval task
219+
example: "451"
220+
subject:
221+
type: string
222+
description: Subject of the Approval
223+
example: Add new Role
224+
description:
225+
type: string
226+
description: Description on the Approval task
227+
example: Adds a new role to the system
228+
priority:
229+
type: integer
230+
description: Priority of the Approval task
231+
example: 0
232+
initiator:
233+
type: string
234+
description: The user who initiated the task
235+
example: some-user-name
236+
approvalStatus:
237+
type: string
238+
description: |
239+
Available only for the completed Tasks, APPROVED or REJECTED if the task has been completed, PENDING otherwise
240+
example: APPROVE
241+
enum:
242+
- PENDING
243+
- APPROVED
244+
- REJECTED
245+
assignees:
246+
type: array
247+
description: |
248+
To whom the task is assigned:
249+
* user - username(s) if the task is reserved for specific user(s).
250+
* group - role name(s) if the task is assignable for group(s).
251+
items:
252+
$ref: '#/components/schemas/Property'
253+
properties:
254+
type: array
255+
items:
256+
$ref: '#/components/schemas/Property'
257+
Property:
258+
type: object
259+
properties:
260+
key:
261+
type: string
262+
value:
263+
type: string
264+
StateDTO:
265+
type: object
266+
properties:
267+
action:
268+
type: string
269+
description: Action to perform on the task.
270+
example: APPROVE
271+
enum:
272+
- CLAIM
273+
- RELEASE
274+
- APPROVE
275+
- REJECT
276+
Error:
277+
required:
278+
- code
279+
- message
280+
type: object
281+
properties:
282+
code:
283+
type: string
284+
example: some_error_code
285+
message:
286+
type: string
287+
example: Some Error Message
288+
description:
289+
type: string
290+
example: Some Error Description
291+
traceId:
292+
type: string
293+
example: Some Correlation for Error Instance
294+
responses:
295+
NotFound:
296+
description: The specified resource is not found
297+
content:
298+
'application/json':
299+
schema:
300+
$ref: '#/components/schemas/Error'
301+
Unauthorized:
302+
description: Unauthorized
303+
ServerError:
304+
description: Internal Server Error
305+
content:
306+
'application/json':
307+
schema:
308+
$ref: '#/components/schemas/Error'
309+
InvalidInput:
310+
description: Invalid input request
311+
content:
312+
'application/json':
313+
schema:
314+
$ref: '#/components/schemas/Error'
315+
Conflict:
316+
description: Element Already Exists
317+
content:
318+
'application/json':
319+
schema:
320+
$ref: '#/components/schemas/Error'
321+
Created:
322+
description: Item Created
323+
OK:
324+
description: OK
325+
Deleted:
326+
description: Item Deleted
327+
Forbidden:
328+
description: Resource Forbidden
329+
parameters:
330+
taskIdPathParam:
331+
name: task-id
332+
in: path
333+
description: Task ID
334+
required: true
335+
schema:
336+
type: string
337+
offsetQueryParam:
338+
name: offset
339+
in: query
340+
description: Number of records to skip for pagination
341+
schema:
342+
minimum: 0
343+
type: integer
344+
format: int32
345+
limitQueryParam:
346+
name: limit
347+
in: query
348+
description: Maximum number of records to return
349+
schema:
350+
minimum: 0
351+
type: integer
352+
format: int32
353+
statusQueryParam:
354+
name: status
355+
in: query
356+
description: |
357+
Approval task's status to filter tasks by their status:
358+
* **RESERVED** - Tasks that are **assigned to** the authenticated user.
359+
* **READY** - Tasks that **can be assigned to** and **can be approved by** the authenticated user.
360+
* **COMPLETED** - Tasks that are **completed by** the user
361+
* \<empty\> - **All** the viewable tasks will be retrieved if this parameter is not specified.
362+
style: form
363+
explode: false
364+
schema:
365+
type: array
366+
items:
367+
enum: [READY, RESERVED, COMPLETED]
368+
securitySchemes:
369+
OAuth2:
370+
type: oauth2
371+
flows:
372+
authorizationCode:
373+
authorizationUrl: 'https://api.asgardeo.io/t/{organization-name}/oauth2/authorize'
374+
tokenUrl: 'https://api.asgardeo.io/t/{organization-name}/oauth2/token'
375+
scopes:
376+
internal_approval_task_view: View approval tasks
377+
internal_approval_task_update: Update approval tasks
Binary file not shown.
Binary file not shown.
Binary file not shown.
65.2 KB
Loading
Binary file not shown.
52.7 KB
Loading
9 KB
Loading
99.6 KB
Loading

0 commit comments

Comments
 (0)