REST Task API

This page does not describe the handling of special "Workflow Tasks". Workflow tasks are visualized in the same UI components than tasks, but have a fundamentally different behavior. For details on how to use Workflow tasks please see REST Workflow Task

Create Task

URL Pattern

/manage/task

Method

POST

Content types

application/json

Media types

application/json

Result

ENTITY_ITEM object of the new task.

Content

The content has to be a JSON object TaskCreationProfile which includes the properties listed below.

Field

Required

Datatype

Parameter description

task

yes

Task

The task's initial properties. Following Task fields are mandatory: name

content

no

ReportQuery

The report query which defines the content of the task.

Properties of the Task object

Field

Datatype

ReadOnly

Parameter description

Remarks

taskType

String

Type of the task, either "SingleTask" or "TaskGroup"

Mandatory. Error if invalid type is provided. Can only be changed for tasks without content.

dynamic

Boolean

Whether task is based on a dynamic query or has static content.

Default is static (false). Can only be changed using the appropriate Update Task Content contentMode.

entity

String

Entity identifier of the task's content type.

If task content is provided, entity must be set. Error if invalid entity. Can only be changed for tasks without content.

name

String

The name of the task. Ideally a meaningful short description of what is to do.

Only if feature 'Language specific Task data' is disabled. Mandatory.

description

String

Optional long description of the task.

Only if feature 'Language specific Task data' is disabled.

parent

ENTITY_ITEM

Parent task group, in case task shall belong to a group.

Error if parent task group does not exist. Error if set for SingleTask.

user

ENTITY_ITEM

The user the task will be assigned to.

At least one of the parameters user or userGroup or supplier have to be given.
If none of them is given the creating user (see below "creationUser") will be used as assigned user by default. If user and userGroup are given the assignee user has priority.

Error if supplier and user/userGroup are given.

Error if user specified does not exist.

userGroup

ENTITY_ITEM

The user group the task will be assigned to.

One of the users of the given user group has to accept the task and will be the assigned user then.

At least one of the parameters user or userGroup or supplier have to be given. If none of them is given the creating user (see below "creationUser") will be used as assigned user by default. If user and userGroup are given the assignee user has priority.

Error if supplier and user/userGroup are given.

Error if userGroup specified does not exist.

supplier

ENTITY_ITEM

The supplier the task will be assigned to.

At least one of the parameters user or userGroup or supplier have to be given. If none of them is given the creating user (see below "creationUser") will be used as assigned user by default.

Error if supplier and user/userGroup are given.

Error if supplier specified does not exist.

Error if supplier does not match the supplier of catalog used for task content (container in the case of workflow task).

substitute

ENTITY_ITEM

The substitute replacing the assign user on the given escalation date/time if task is not completed yet.

responsible

ENTITY_ITEM

The responsible user.

creationUser

ENTITY_ITEM

yes

The user who created the task.

Set automatically

creationDate

DATETIME

yes

The date/time the task has been created.

Set automatically

escalationDate

DATETIME

The date/time the task escalates and the delegate is assigned replacing the originally assigned user.

deadline

DATETIME

The date/time the task is scheduled to be fulfilled. If deadline is reached, task will be assigned to responsible.

finishEstimate

DATETIME

The date/time the assigned user plans to fulfill the task (pure information).

finishDate

DATETIME

The date/time the task has been finished.

progress

Integer

The progress of the task (pure information).

When creating the progress 0% is used. Error if given value does not exist in progress enum (0-5).

priority

Integer

The priority of that task (pure information).

When creating the priority "normal" is used. Error if given value does not exist in priority enum (0,1,2).

notificationLevel

Integer

The profile for email notification to be used with that task.

System wide default notification level is used when creating a task.

count

Integer

yes

Number of objects in task.

Set automatically

displayOrder

Integer

Display order for arranging task in UI.

Set automatically when creating a task.

accepted

Boolean

yes

Whether task has been accepted or not.

acceptanceDate

DATETIME

yes

The date/time when the task has been accepted by an assignee.

Set automatically when accepting a task.

workflowTaskId

Long

Id of the workflow associated with the task.
(Hint: this is not related to InfaBPM workflows!)

Deprecated field. This has been used to combine Tasks with the old Workflow engine which is no longer in use.

complete

Boolean

Calculated parameter reflecting completion status.

If finishDate contradicts the intended completion status, finishDate is updated.

template

ENTITY_ITEM

UI template the task is bound to

For flexible task UI

workflowServiceEndpoint

String

The endpoint which is to be triggered on Informatica BPM side when a workflow task is marked as finished.

workflowCorrelationId

String

The correlation id of the workflow instance which is to be triggered on InfaBPM side when a workflow task is marked as finished.

workflowCommunicationMode

QUEUE/REST

The communication mode which can define message queue or REST communication to BPM

workflowQueueId

String

The queue id from the server.properties which is defined by the syntax "queue.[queueId].name" which is used for the response message

taskLangs

Map<String,String>

The language specific data of a task.

Only if feature 'Language specific Task data' is enabled

Properties of the TaskLang object (only if feature 'Language specific Task data' is enabled)

Field

Datatype

ReadOnly

Parameter description

Remarks

languge

String

The language of the name and description. Valid values include all synonyms of Enum.Language.WithLanguageIndependent

name

String

The name of the task. Ideally a meaningful short description of what is to do.

description

String

Optional long description of the task.

Result

An object reference of the new task.

Field

Data type

Description

id

Integer

The task id

label

String

The label of the task

Update Task

URL Pattern

/manage/task/{task-id}

Method

POST

Content types

application/json

Updates task properties (fields). To update the list of entities associated with the task use Update Task Content .

Content

The content has to be a Task JSON object (see above).

Get Task

URL Pattern

/manage/task/{task-id}

Method

GET

Media types

application/json

Result

Task object

Delete Task

URL Pattern

/manage/task/{task-id}

Method

DELETE

Media types

application/json

Result

'true'/'false' string whether object could be deleted

Update Task Content

URL Pattern

/manage/task/{task-id}/content/{entity}

Method

POST

Parameters

contentMode: add, remove, set - default: set

queryMode: static, dynamic - default: static.

Content types

application/json

Media types

application/json

Result

ENTITY_ITEM object of the updated task.

A task with static contents has a list of entity items (Products, Items etc) associated with it while a task with dynamic contents has an associated query. Setting task contents changes task dynamic property accordingly. Static contents can be adjusted by adding and removing items with the corresponding contentMode and static queryMode. Adding to and removing from a dynamic task is not possible. The corresponding task will be updated (which can be time consuming) before returning the result.

Content

The content has to be a valid ReportQuery JSON object (see above). Content of tasks created for supplier must contain objects from catalogs of assigned supplier only.

Get Task Content

URL Pattern

/manage/task/{task-id}/content

Method

GET

Parameters

updateTask: updates the task if set to true, by default - false.

Content types

-

Media types

application/json

Result

report result object

Returns report result object, which contains all information from internal report result + entity identifier.

If updateTask is set, corresponding task will be updated (which can be time consuming) before returning the result.

List Management API should be used to obtain actual report items, for example

http://localhost:1501/rest/V1.0/list/Article/byReportId?reportId=<report_id>&datasource=PCM_MASTER

Workflow callback

If the workflowServiceEnpoint and workflowCorrelationId parameters are set, the application server will send a callback message to the Informatica BPM server as soon as the task gets marked as complete.

The callback message posts e.g. following XML body:

<taskCompletedRequest>
    <taskId>10146</taskId>
    <task>
        <taskType>SingleTask</taskType>
        <name>Test task callback</name>
        <priority>1</priority>
        <notificationLevel>1</notificationLevel>
        <creationDate>2015-10-21T14:38:40:580+0200</creationDate>
        <escalationDate/>
        <deadline/>
        <finishEstimate/>
        <finishDate/>
        <progress>0</progress>
        <dynamic>false</dynamic>
        <count>2</count>
        <entity>Article</entity>
        <displayOrder>3125</displayOrder>
        <creationUser>restuser</creationUser>
        <user>Administrator</user>
        <responsible>restuser</responsible>
        <accepted>true</accepted>
        <complete>true</complete>
    </task>
</taskCompletedRequest> 

The <user> tag will carry the user who accepted the task before completion.

Information Page

A short version of the API description is available at /manage/task/info.

Examples

Create a task for all items in the catalog TOOLS


Rest Client Java Code
EntityItemReference catalog = EntityItemReferenceFactory.createByIdentifier( "TOOLS" );
  ReportQuery reportQuery = new ReportQuery( "byCatalog" );
reportQuery.addParameterValue( "catalog", catalog );
Task task = new Task();
task.setName( "Verify all tools" );
task.setTaskType( TaskType.SINGLE.classifier() );
task.setEntity( "Article" );
TaskCreationProfile taskProfile = new TaskCreationProfile();
taskProfile.setTask( task );
taskProfile.setContent( reportQuery );
 
TaskRequest taskRequest = getRestClient().createTaskRequest();
EntityItemReference newTask = taskRequest.createTask( taskProfile );
Long taskId = Long.valueOf( newTask.getId() );
JSON
//POST to http://localhost:1501/rest/V1.0/manage/task
{
"task":{"name":"Verify all tools.",
"taskType":"SingleTask",
"entity":"Article"
},
"content":{"identifier":"byCatalog",
"parameterList":[{"key":"Catalog","value":"'TOOLS'"}]
}
}

Create a task for supplier

Use POST request like http://<server>:<port>/rest/V1.0/manage/task

Create a task for Supplier
{
"task":{
"taskType" : "SingleTask",
"name" : "Task for supplier created via Service API",
"supplier" : "SUPPLIER_FOR_TASKS",
"responsible" : "Administrator"
}},
"content":{
"identifier":"byCatalog",
"parameterList":[{"key":"Catalog","value":"'CATALOG_OF_SUPPLIER_FOR_TASKS'"}]
}
}

Update a task: Change name and description

Rest Call
curl -u rest:heiler -H "Accept: application/json" "Content-Type: application/json" -X POST http://localhost:1501/rest/V1.0/manage/task/1/
JSON
{
"name":"Check short descriptions",
"description" : "Check short descriptions in German and English"
}

Update a task's content: Add another item

Rest Call
curl -u rest:heiler -H "Accept: application/json" "Content-Type: application/json" -X POST http://localhost:1501/rest/V1.0/manage/task/1/content/Article?contentMode=add&queryMode=static
JSON
{
 "identifier": "byItems",
"parameterList": [
{
"key": "items",
"value": "'I-3'@1"
}
]
}