Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 4d79f14

Browse files
authored
Docs
1 parent 74cbf3b commit 4d79f14

File tree

1 file changed

+188
-32
lines changed

1 file changed

+188
-32
lines changed

README.md

Lines changed: 188 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ Restful web API for InterSystems Ensemble Workflow
44

55
## Installation
66
1. Import and compile this project.
7-
2. Create a web-application for REST in the Portal Management System (for ex. /csp/workflow/rest). Set dispatch class to Workflow.REST, Authentication methods to 'Unauthorized' and 'Password'.
8-
3. (Optional) add Workflow package mapping if you need to query another namespace.
7+
2. Create a web-application for REST in the Portal Management System (for ex. `/csp/workflow/rest`). Set dispatch class to `Workflow.REST`, Authentication methods to 'Unauthorized' and 'Password'.
8+
3. (Optional) Add Workflow package mapping if you need to query another namespace.
99

1010

1111
##Requests
1212

1313
These are the possible requests to web application (add param `?Namespace={Desired Namespace}` to query another namespace):
1414

15-
| URL | Type | Body (JSON) | Response | Description |
16-
|-----------------------------|------|-----------------------------|-----------|--------------------------------|
17-
| tasks | GET | | JSON | Get unassigned tasks or tasks assigned to current user |
18-
| tasks/:id | GET | | JSON | EnsLib.Workflow.Worklist object|
19-
| tasks/:id | POST |{EnsLib.Workflow.Worklist object}|JSON | Processing of modified object |
20-
| test | GET | | JSON | Test info |
15+
| URL | Type | Response | Description |
16+
|-----------------------------|------|-----------|--------------------------------|
17+
| tasks | GET | JSON | Get unassigned tasks or tasks assigned to current user |
18+
| tasks/:id | GET | JSON | EnsLib.Workflow.Worklist object|
19+
| tasks/:id | POST | JSON | Processing of modified object |
20+
| test | GET | JSON | Test info |
2121

2222

2323
## Prerequisites
@@ -47,36 +47,35 @@ It's the basic and first requst you need to execute after logging in (by authent
4747
{
4848
"children":[
4949
{
50-
"ID":"383015||user4",
51-
"New":"",
50+
"ID":"317||dev",
51+
"New":"*",
5252
"Priority":3,
53-
"Subject":"Task subject",
54-
"Message":"some additional message",
55-
"TaskId":383015,
56-
"RoleName":"Role",
57-
"AssignedTo":"user4",
58-
"TimeCreated":"2016-12-07 22:09:03.599",
59-
"Age":"00w 0d 16h 32m 30s",
60-
"UserName":"user4"
53+
"Subject":"Problem reported by TestUser",
54+
"Message":"SampleTask",
55+
"TaskId":317,
56+
"RoleName":"Demo-Development",
57+
"AssignedTo":"",
58+
"TimeCreated":"2016-12-04 14:30:47.657",
59+
"Age":"00w 3d 23h 31m 58s",
60+
"UserName":"dev"
6161
},
6262
{
63-
"ID":"383011||user4",
64-
"New":"*",
65-
"Priority":1,
66-
"Subject":"Task subject",
67-
"Message":"some additional message",
68-
"TaskId":383011,
69-
"RoleName":"Role",
70-
"AssignedTo":"",
71-
"TimeCreated":"2016-12-07 20:43:21.627",
72-
"Age":"00w 0d 17h 58m 12s",
73-
"UserName":"user4"
63+
"ID":"345||dev",
64+
"New":"",
65+
"Priority":3,
66+
"Subject":"Problem reported by TestUser",
67+
"Message":"SampleTask",
68+
"TaskId":345,
69+
"RoleName":"Demo-Development",
70+
"AssignedTo":"dev",
71+
"TimeCreated":"2016-12-04 14:30:35.647",
72+
"Age":"00w 3d 23h 32m 10s",
73+
"UserName":"dev"
7474
}
75-
],
76-
"total":2
75+
]
7776
}
7877
```
79-
Here we can see two tasks, fist assigned to a current user (user4) and second one unassigned to the user. Object properties are
78+
Here we can see two tasks, fist assigned to a current user (dev) and second one unassigned to the current user. Object properties are
8079

8180
| Property | Description | Value |
8281
|-------------|------------------------------------------------------------------------------------|--------------------------------------------------------|
@@ -91,3 +90,160 @@ Here we can see two tasks, fist assigned to a current user (user4) and second on
9190
| TimeCreated | Creation time | UTC timestamp |
9291
| Age | Age of this item | |
9392
| UserName | Current workflow user (EnsLib.Workflow.UserDefinition) | Current user |
93+
94+
## GET tasks/:id
95+
96+
After you received main information about available tasks, you can see it in more detail, by requesting it by id (`345||dev` in example). Here's how response object looks like:
97+
98+
```
99+
{
100+
"_class":"EnsLib.Workflow.Worklist",
101+
"_id":"345||dev",
102+
"Task": {
103+
"_class":"EnsLib.Workflow.TaskResponse",
104+
"_id":345,
105+
"%Action":"",
106+
"%Priority":3,
107+
"%UserName":"",
108+
"%UserTitle":"",
109+
"%UserRanking":"",
110+
"%RoleName":"Demo-Development",
111+
"%Subject":"Problem reported by TestUser",
112+
"%Message":"SampleTask",
113+
"%Actions":"Corrected,Ignored",
114+
"%FormTemplate":"",
115+
"%FormFields":"Comments",
116+
"%FormValues": {},
117+
"%Status":"Assigned",
118+
"%TaskStatus": {
119+
"_class":"EnsLib.Workflow.TaskStatus",
120+
"Role": {
121+
"_class":"EnsLib.Workflow.RoleDefinition",
122+
"_id":"Demo-Development",
123+
"Name":"Demo-Development",
124+
"Description":"",
125+
"Capacity":100
126+
},
127+
"AssignedTo":"dev",
128+
"TimeCreated":"2015-03-04 13:27:39.917",
129+
"TimeCompleted":"",
130+
"SessionId":291,
131+
"Source":"HelpDesk",
132+
"ResponseToken":"323|Demo.Workflow.Production",
133+
"IsComplete":false,
134+
"Request": {
135+
"_class":"EnsLib.Workflow.TaskRequest",
136+
"_id":344,
137+
"%Actions":"Corrected,Ignored",
138+
"%Subject":"Problem reported by TestUser",
139+
"%Message":"SampleTask",
140+
"%Priority":3,
141+
"%UserName":"",
142+
"%Title":"",
143+
"%TaskHandler":"",
144+
"%Command":"",
145+
"%FormTemplate":"",
146+
"%FormFields":"Comments",
147+
"%FormValues": {}
148+
}
149+
}
150+
},
151+
"User": {
152+
"_class":"EnsLib.Workflow.UserDefinition",
153+
"_id":"dev",
154+
"Name":"dev",
155+
"FullName":"",
156+
"IsActive":true
157+
},
158+
"Role":null,
159+
"TimeCreated":"2016-12-04 14:30:35.647",
160+
"IsNew":false,
161+
"Age":"00w 3d 23h 34m 48s"
162+
}
163+
```
164+
165+
It's just a json representation of [EnsLib.Workflow.Worklist](http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=ENSLIB&CLASSNAME=EnsLib.Workflow.Worklist) object.
166+
This request provides enouth information to display task to the user.
167+
168+
## POST tasks/:id
169+
170+
After user is done working on his task, you need to notify Workflow engine about new state of the task. To do thet, execute this request, with the json representation of EnsLib.Workflow.Worklist object (received from the previous request) as a body.
171+
To express changes made by user, modify EnsLib.Workflow.Worklist object:
172+
173+
- Set `Task.%Action` property to one of %Actions values or `$Accept` to accept task, `$Relinquish` to relinquish task and `$Save` to save changes made to task
174+
- Provide `Task.%FormValues` as an array with kays from `%FormFields` and values provided from a client
175+
176+
Here's an example of user completing `345||dev` task (by choosing Corrected action):
177+
178+
```
179+
{
180+
"_class":"EnsLib.Workflow.Worklist",
181+
"_id":"345||dev",
182+
"Task":{
183+
"_class":"EnsLib.Workflow.TaskResponse",
184+
"_id":345,
185+
"%Action":"Corrected",
186+
"%Priority":3,
187+
"%UserName":"",
188+
"%UserTitle":"",
189+
"%UserRanking":"",
190+
"%RoleName":"Demo-Development",
191+
"%Subject":"Problem reported by TestUser",
192+
"%Message":"SampleTask",
193+
"%Actions":"Corrected,Ignored",
194+
"%FormTemplate":"",
195+
"%FormFields":"Comments",
196+
"%FormValues":{
197+
"Comments":"user-made comment"
198+
},
199+
"%Status":"Assigned",
200+
"%TaskStatus":{
201+
"_class":"EnsLib.Workflow.TaskStatus",
202+
"Role":{
203+
"_class":"EnsLib.Workflow.RoleDefinition",
204+
"_id":"Demo-Development",
205+
"Name":"Demo-Development",
206+
"Description":"",
207+
"Capacity":100
208+
},
209+
"AssignedTo":"dev",
210+
"TimeCreated":"2015-03-04 13:27:39.917",
211+
"TimeCompleted":"",
212+
"SessionId":291,
213+
"Source":"HelpDesk",
214+
"ResponseToken":"323|Demo.Workflow.Production",
215+
"IsComplete":false,
216+
"Request":{
217+
"_class":"EnsLib.Workflow.TaskRequest",
218+
"_id":344,
219+
"%Actions":"Corrected,Ignored",
220+
"%Subject":"Problem reported by TestUser",
221+
"%Message":"SampleTask",
222+
"%Priority":3,
223+
"%UserName":"",
224+
"%Title":"",
225+
"%TaskHandler":"",
226+
"%Command":"",
227+
"%FormTemplate":"",
228+
"%FormFields":"Comments",
229+
"%FormValues":{
230+
}
231+
}
232+
}
233+
},
234+
"User":{
235+
"_class":"EnsLib.Workflow.UserDefinition",
236+
"_id":"dev",
237+
"Name":"dev",
238+
"FullName":"",
239+
"IsActive":true
240+
},
241+
"Role":null,
242+
"TimeCreated":"2016-12-04 14:30:35.647",
243+
"IsNew":false,
244+
"Age":"00w 3d 23h 46m 40s"
245+
}
246+
```
247+
248+
249+

0 commit comments

Comments
 (0)