A User Task is a typical process or workflow task where a human performs the Task with the assistance of a software application and is scheduled through a task list manager.
In the previous version it was possible to manage User Tasks through the Process API offered to operate on any work item.
In this version there is a new subsystem in the Runtime Engine, that is designed to work more effectively with User Tasks. Consequently, a new API (User Tasks API) layer specifically designed to operate with User Tasks entities is now available to the BAMOE users.
The resulting User Tasks Api is lighter and focused on working with
User Tasks: the new endpoints no longer require global
process data like the process ID, process Instance ID, task Name as endpoint parameters, and the returned JSON objects contain richer information.
|
Note
|
Migrating to the new API for User Task related operations is
required. The Process API endpoints are still being provided to
interact with the Workflow engine for WorkItem related operations. It is
important to understand that the User Task engine supports a different
lifecycle model compared to the Workflow engine. Invoking the General
Process API results in a state change of the WorkItem inside the Process
engine, whereas invoking the new User Task API results in a state change
of the User Task itself. Using the Process API for User Tasks
will result in unexpected outcomes and is therefore not recommended.
This document describes the new entrypoints and a guide to support a
migration to the new API. In addition, the usage of both APIs to work with User Tasks is not recommended and it should be avoided. You should perform ALL the User Tasks operations using the new User Tasks API. |
With the new endpoints, it’s possible to operate with the following Entities:
-
User Tasks (GET)
-
Transitions (GET, POST)
-
Input (PUT)
-
Output (PUT)
-
Comments (GET, POST, DELETE)
-
The following sections describe the User Task API in detail.
/usertasks/instance
| Type | GET |
|---|---|
Description |
It returns a list of User Tasks assigned to a given user and a given group |
Inputs |
|
Output |
A JSON List of UserTaskView elements that describes all the User Tasks assigned to a given user / group. UserTaskView:
|
Example |
curl -X 'GET' \ 'http://localhost:8080/usertasks/instance?group=managers&user=manager' |
/usertasks/instance/{taskId}
| Type | GET |
|---|---|
Description |
It returns the User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON UserTaskView Element that describes the requested User Task assigned to a given user / group. UserTaskView:
A UserTaskInstanceNotFoundException is thrown if there is no User Task that matches with the given parameters. |
Example |
curl -X GET \
'http://localhost:8080/usertasks/instance/{taskId}?group=managers&user=manager'
|
/usertasks/instance/{taskId}/transition
| Type | GET |
|---|---|
Description |
It returns the allowed transitions for a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Collection of UserTaskTransitionView elements, that represents the list of allowed transition for a specific User Task. A UserTaskTransitionView element contains:
|
Example |
curl -X GET \
'http://localhost:8080/usertasks/instance/{taskId}/transition?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/transition
| Type | POST |
|---|---|
Description |
It applies a transition for a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON UserTaskView Element which represents the User Task to which the given transition was applied. UserTaskView:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -H "Content-Type: application/json" -H "Accept: application/json" \
-X POST \
'http://localhost:8080/usertasks/instance/{taskId}?user={user}&group={groups}' \
-d '{transitionId: String, data: Map<String, Object>}'
|
/usertasks/instance/{taskId}/inputs
Type |
PUT |
Description |
It associates input properties with a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON UserTaskView Element which represents the User Task to which the given input parameters were added. UserTaskView:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X PUT \
'http://localhost:8080/usertasks/instance/{taskId}/inputs?group=managers&user=manager' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "variable": "value" }'
|
/usertasks/instance/{taskId}/outputs
| Type | PUT |
|---|---|
Description |
It associates output properties with a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON UserTaskView Element which represents the User Task to which the given output parameters were added. UserTaskView:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X PUT \
'http://localhost:8080/usertasks/instance/{taskId}/outputs?group=managers&user=manager' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "variable": "value" }'
|
/usertasks/instance/{taskId}/comments
| Type | GET |
|---|---|
Description |
It returns the all the comments associated with a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Collection of Comment elements. This is composed by:
|
Example |
curl -X GET \
'http://localhost:8080/usertasks/instance/{taskId}/comments?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/comments
| Type | POST |
|---|---|
Description |
It adds a comment for a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Comment element, representing the added Comment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -H "Content-Type: application/json" -H "Accept: application/json" \
-X POST \
'http://localhost:8080/usertasks/instance/{taskId}/comments?user={user}&group={groups}' \
-d '{ "comment": "String"}'
|
/usertasks/instance/{taskId}/comments/{commentId}
| Type | GET |
|---|---|
Description |
It retrieves a specific comment for a specific User Task given its comment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Comment element, representing the Comment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X GET \
'http://localhost:8080/usertask/instance/{taskId}/comments/{commentId}?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/comments/{commentId}
| Type | POST |
|---|---|
Description |
It updates a specific comment for a specific User Task given its comment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Comment element, representing the updated Comment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -H "Content-Type: application/json" -H "Accept: application/json" \
-X POST \
'http://localhost:8080/usertasks/instance/{taskId}/comments/{commentId}?user={user}&group={groups}' \
-d '{ "comment": "String"}'
|
/usertasks/instance/{taskId}/comments/{commentId}
| Type | DELETE |
|---|---|
Description |
It deletes a specific comment for a specific User Task given its comment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Comment element, representing the deleted Comment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X DELETE \
'http://localhost:8080/usertasks/instance/{taskId}/comments/{commentId}?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/attachments
| Type | GET |
|---|---|
Description |
It returns the all the Attachments associated with a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Collection of Attachments elements. This is composed by:
|
Example |
curl -X GET \
'http://localhost:8080/usertasks/instance/{taskId}/attachments?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/attachments
| Type | POST |
|---|---|
Description |
It adds an Attachment for a specific User Task given its task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Attachments element, representing the Attachment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -H "Content-Type: application/json" -H "Accept: application/json" \
-X POST \
'http://localhost:8080/usertasks/instance/{taskId}/attachments?user={user}&group={groups}' \
-d '{ "name": "String", "uri": "URI" }'
|
/usertasks/instance/{taskId}/attachments/{attachmentId}
| Type | GET |
|---|---|
Description |
It retrieves a specific Attachment for a specific User Task given its attachment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Attachment element, representing the Attachment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X GET \
'http://localhost:8080/usertasks/instance/{taskId}/attachments/{attachmentId}?user={user}&group={groups}'
|
/usertasks/instance/{taskId}/attachments/{attachmentId}
| Type | POST |
|---|---|
Description |
It updates a specific Attachment for a specific User Task given its attachment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Attachment element, representing the updated Attachment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -H "Content-Type: application/json" -H "Accept: application/json" \
-X POST \
'http://localhost:8080/usertasks/instance/{taskId}/attachments/{attachmentId}?user={user}&group={groups}' \
-d '{ "name": "String", "uri": "URI" }'
|
/usertasks/instance/{taskId}/attachments/{attachmentId}
| Type | DELETE |
|---|---|
Description |
It deletes a specific comment for a specific User Task given its attachment ID, task ID and assigned to a given user and a given group |
Inputs |
|
Output |
A JSON Attachment element, representing the deleted Attachment which matches the given parameters. This is composed by:
A UserTaskInstanceNotFoundException is thrown if a User Task that matches with the given parameters doesn’t exist. |
Example |
curl -X DELETE \
'http://localhost:8080/usertasks/instance/{taskId}/attachments/{attachmentId}?user={user}&group={groups}'
|
To find out more on how the passed QueryParameters representing the user and the groups associated to a given User Task are integreted with the native BAMOE authentication system, see the Security chapter of this guide.