GET method for the list of task instances resource

The GET method returns a collection that lists all of the tasks that are running for a particular case. In the collection, the tasks are grouped according to whether they are required, optional, or disabled.

URI

/CASEREST/v1/case/{case folder id}/tasks

The URI for the GET method includes the following path element:
Table 1. Path element for the GET method
Name Type Description
{case folder id} String The GUID that identifies the root folder of the case for which tasks are to be returned.
The URI for the GET method includes the following parameters:
Table 2. Parameters for the GET method
Name Type Required? Description
TargetObjectStore String Yes The symbolic name of the object store that contains the case.

A symbolic name is called a unique identifier in IBM® Business Automation Workflow.

Grouping String Yes The identifier that indicates grouping for the tasks. You must set this parameter to ROD, which represents the following groups:
Required
This group includes tasks for which the RequiredState property is set to REQUIRED_BY_USER or REQUIRED_BY_INCLUSIVE.
Optional
This group includes tasks that are enabled and for which the RequiredState property is set to OPTIONAL.
Disabled
This group includes tasks that are disabled and for which the DisabledState property is set to DISABLED_BY_USER, DISABLED_BY_EXCLUSIVE, or DISABLED_BY_ABORTED.

The GET method does not return groups that are empty.

The groups can be returned in any order. Within each group, the tasks are ordered first by the task state and then by the task name.

Request content

The request for this method contains no JSON content.

Response content

For the task, the method returns:
  • The required state of the task
  • The disabled state of the task
  • The launch mode state of the task
  • The date the task was created
  • The task identifier
  • The task name
  • The task number
  • The date the task was last modified
  • Whether the task is hidden
  • Whether the task is a container
  • The process instance ID
  • The date the task was last restarted
  • The restart count
  • The roster name
The GET method also returns one of the following response codes:
Table 3. Response codes for the GET method
Code Description
200 OK The method completed successfully and returned the requested list of tasks.
400 Bad Request The required TargetObjectStore parameter or Grouping parameter was not specified, or a parameter value was invalid.
404 Not Found The case folder that was specified in the request URI was not found.
500 Internal Server Error A server error occurred. For information about the error, see the userMessage element in the JSON response.

Example: GET method request

This sample code requests a list of all the tasks that are running for a specified case (with ID ending in F2ED):
GET http://example.com:9080/CaseManager/CASEREST/v1/case
/9E45A997-0E42-406E-AAC4-EE55D8BCF2ED/tasks
?TargetObjectStore=MyExampleObjectStore&Grouping=ROD
HTTP/1.1
Host: www.CaseMgmtExample.net

Example: GET method response

This sample code shows the response to the request, with the list of tasks that are running for the case given in the request. If a task is in the failed state, the response also includes a FailureReason element that describes the reason for the failure. The text provided for this element might not be available in languages other than English.
#Response
HTTP/1.1 200 OK
Content-Type: application/json;charset-UTF-8
{
  "Optional":
  [
    {
      "RequiredState": 0, "TaskState": 3, "DisabledState": 0,
      "LaunchMode": 0, "DateCreated": "2010-07-16T21:50:36Z",
      "TaskId": "{3B5C8E64-43FE-4188-AC72-457A4B8E374C}",
      "TaskName": "ETECase2 Task number 2",
      "DateLastModified": "2010-07-16T21:50:36Z",
      "IsHidden": false,
      "IsContainer": false,
      "ProcessInstanceId": "0907E35E7DC03B4FA03F6B6767633FB2",
      "LastRestartDate": "2010-07-16T21:50:36Z",
      "RestartCount": "1",
      "RosterName": "MySolution1"
    }
  ],
  "Required":
  [
    {
      "RequiredState": 1, "TaskState": 1, "DisabledState": 0,
      "LaunchMode": 4, "DateCreated":"2010-07-16T21:50:36Z",
      "TaskId": "{CB3F1916-8D03-44C8-9598-23589D9ED78F}",
      "TaskName": "ETECase2 Task number 1",
      "DateLastModified": "2010-07-16T21:50:36Z"
      "IsHidden": false,
      "IsContainer": false,
      "ProcessInstanceId": "0907E35E7DC03B4FA03F6B6767633FB1",
      "LastRestartDate": null,
      "RestartCount": "0",
      "RosterName": "MySolution1"
    }
  ]
}