PUT method for the particular task instance resource

The PUT method updates a specified task. Typically, you use this method to start, enable, or disable a task.

To avoid unnecessary Content Platform Engine errors, the PUT method ensures that the task is in the correct state before the task is updated. If a case worker requests to disable a task, the PUT method ensures that the task is not in a working or complete state. If the task is in a working or complete state, the method ignores the request. If a case worker requests to start a task, the PUT method ensures that the task is in a ready state.

Because multiple case workers might decide a task must be enabled, the PUT method does not return an error when a request is made to enable a task that is already enabled. Instead, the method always returns an updated version of the task.

URI

/CASEREST/v1/task/{taskId}

The URI for the PUT method includes the following path element and parameters:
Path element
Table 1. Path element for the PUT method
Name Type Description
{taskId} String The GUID for the task instance that is to be updated.
Parameters
Table 2. Parameters for the PUT method
Name Type Required? Description
TargetObjectStore String Yes The symbolic name of the object store that contains the task.

A symbolic name is called a unique identifier in IBM® Case Manager.

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 PUT method does not return groups that are empty.

Request content

{
  "action": "<start or enable or disable or stop or restart>"     
}
Important: For a restart request to succeed, the user who makes the call must have create rights for the roster of the solution. For a stop request to succeed, the user who makes the call must have read rights on all queues in the solution. By default, all users have read rights to queues, but if you have customized Content Platform Engine security, you must add read rights for users who might call this API.

Response content

For the task that is updated, 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
The PUT method also returns one of the following response codes:
Table 3. Response codes for the PUT method
Code Description
200 OK The method completed successfully. No content is returned.
400 Bad Request The TargetObjectStore parameter or the Grouping parameter was not specified, or a parameter value was invalid.
404 Not Found The task 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: PUT method

This example disables a task.
Request example
PUT http://example.com:9080/CaseManager/CASEREST/v1/task
/7A75A997-0E42-406E-AZC4-EE55D7DER9PF?TargetObjectStore=MyExampleObjectStore
&Grouping=ROD HTTP 1.1
Host: www.example.net
{
  "Action": "disable"
}
Response example
If a task is in the failed state, the response also includes a FailureReason field that describes the reason for the failure.
#Response
HTTP/1.1 200 OK
Content-Type: application/json;charset-UTF-8
{
  "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"
    }
  ]
}