IBM Business Process Manager, Version 8.5.5

REST interface for BPD-related resources - Task Instance Resource - PUT (setData) Method

Use this method to set one or more variables within a running task.

Sample method invocation

PUT /rest/bpm/wle/v1/task/{taskId}?action={string}&params={string}[&failureMode={string}]

Alternative Method Invocation

POST /rest/bpm/wle/v1/task/{taskId}?action={string}&params={string}[&failureMode={string}]

Parameters

Required parameters
NameValue TypeDescription
action string
A string indicating the action to be taken on the service.
ValueDescription
setData
Sets one or more variables within the context of a running task.
params string
A string containing a JSON expression that contains one or more variable settings. Each of the variables will be set in the context of the running task.

Example:

..../v1/task/<taskId>?action=setData&params={"orderNumber":"5","customerName":{"firstName":"John","lastName":"Doe"}}

Optional parameters
NameValue TypeDescription
failureMode string
A string which represents how variable-related failures should be handled.
ValueDescription
embedded_pi
Variable-related failure information is embedded in the response data structure in place of the variable itself.
embedded
Variable-related failure information is embedded as ExceptionData objects in the response data.
fail_fast
The API request will return after the first variable-related failure. This is the default.

Request content

MIME type: application/x-www-form-urlencoded

Use this mime-type in situations where the length of the query string might cause the request URI to exceed the maximum length supported by the browser or HTTP client environment. With this mime-type, you can move all of your query parameters to the HTTP request body and avoid request URI length restrictions.

Example:

   POST  http://myhost.mycompany.com:9080/rest/bpm/wle/v1/task/31

   HTTP Headers:
      Content-Type: application/x-www-form-urlencoded
      X-Method-Override: PUT
      Accept: application/json

   HTTP Request Body:
      action=setData&params={"orderNumber":"5","customerName":{"firstName":"John","lastName":"Doe"}}

Response content

Service Result (Result complexType).

The default content type is application/json.

MIME type: application/json


+ View schema
{  "description": "WLE Service Result", 
   "type": "object",
   "properties":
   {
      "result": {"type": "[string]",
         "description": "A list of strings which represent the result obtained from evaluating a javascript expression within the context of a currently running service."
      }
   }
}
+ View example content
{
   "status":"200",
   "data":{
      "result":"100"
   }
}

MIME type: application/xml


+ View schema
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://rest.bpm.ibm.com/v1/data/service"
	elementFormDefault="unqualified"
	xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://rest.bpm.ibm.com/v1/data/service"
	xmlns:pref="http://rest.bpm.ibm.com/v1/data/root"
	xmlns:cmn="http://rest.bpm.ibm.com/v1/data/common">

    <import schemaLocation="Common.xsd" namespace="http://rest.bpm.ibm.com/v1/data/common"/>
    <import schemaLocation="BPMRestData.xsd" namespace="http://rest.bpm.ibm.com/v1/data/root"/>

    <!--
	This type represents a service model.
    -->
    <complexType name="ServiceModel">
	<complexContent>
	    <extension base="pref:Data">
		<sequence>

		    <!-- This field corresponds to the "header" part of the service model -->
		    <element name="header" type="tns:Header"/>

		    <!-- This field corresponds to the "diagram" part of the service model -->
		    <element name="diagram" type="tns:Diagram"/>

		    <!-- This field corresponds to the "dataModel" part of the service model -->
		    <element name="dataModel" type="tns:DataModel"/>
		</sequence>
	    </extension>
	</complexContent>
    </complexType>

    <complexType name="Header">
	<sequence>

	    <!-- The unique ID of the service -->
	    <element name="UUID" type="string" />
	    
	    <!-- The type of the service -->
	    <element name="type" type="string" />
	    
	    <!-- The name of the service -->
	    <element name="name" type="string" />

	    <!-- The description of the service -->
	    <element name="description" type="string" />
	    <element name="richDescription" type="string" />
	    
	    <!-- The snapshot ID of the service -->
	    <element name="snapshotId" type="string" />
	    
	    <!-- Warning -->
	    <element name="warning" type="string" />

	    <!-- not used -->
	    <element name="startTaskURL" type="string" />

	    <!-- not used -->
	    <element name="startServiceURL" type="string" />
	</sequence>
    </complexType>


    <complexType name="Diagram">
	<sequence>

	    <!-- The list of steps associated with the service -->
	    <element name="step" type="tns:ServiceStep" minOccurs="0" maxOccurs="unbounded" />
	</sequence>
    </complexType>

    <complexType name="DataModel">
	<sequence>

	    <!-- The variables (properties) associated with the service
	         The key is the name of the property.
	         The value containing a description of the property:
	            * type (name of the type)
	            * isList
	            * description
	            * richDescription
	    -->
	    <element name="properties" type="cmn:Map" />

	    <!-- The input variables associated with the service
	         The key is the name of the variable.
	         The value containing a description of the parameter:
	            * type (name of the type)
	            * isList
	            * description
	            * richDescription
	    -->
	    <element name="inputs" type="cmn:Map" />

	    <!-- The output variables associated with the service
	         The key is the name of the variable.
	         TThe value containing a description of the parameter:
	            * type (name of the type)
	            * isList
	            * description
	            * richDescription
	    -->
	    <element name="outputs" type="cmn:Map" />

        <!-- Detailed information about the types referenced by the service.
             Each type referenced above and nested types are described.
	         The key is the name of the type.
	         The value is an map of information about the type  Here are some of the fields:
	            * ID, pattern, properties, isShared, options, min, max, description, fixedLength
	    -->
	    <!-- A structure explaining the data model of the service -->
	    <element name="validation" type="cmn:Map" />
	</sequence>
    </complexType>

    <!--
	This type represents a step associated with a service.
    -->
    <complexType name="ServiceStep">
	<sequence>

	    <!-- The step ID -->
	    <element name="ID" type="string" />

	    <!-- The step name -->
	    <element name="name" type="string" />

	    <!-- The X, Y coordinate of the center point of the step within the diagram -->
	    <element name="x" type="int" />
	    <element name="y" type="int" />

	    <!-- The step type -->
	    <element name="type" type="string" />
	    
	    	    
	    <!-- Web Service Integration Data -->
	    <element name="data" type="tns:WSIntegrationData" />

	    <!-- The set of lines extending out from this step within the diagram -->
	    <element name="lines" type="tns:ServiceStepLines" />
	</sequence>
    </complexType>
    
    <!-- 
	 This type represents webservices integration data
    -->
    <complexType name="WSIntegrationData">
	<sequence>
	    <element name="wsdlURI" type="string" />
	    <element name="serviceName" type="string" />
	    <element name="portName" type="string" />
	    <element name="operationName" type="string" />
	    <element name="isProtectedWSDL" type="boolean" />
        <element name="isOverrideEndpointAddress" type="boolean" />
        <element name="endpointAddressURL" type="string" />
	</sequence>
    </complexType>
    
    <!-- 
	 This type represents a set of lines associated with a service step
    -->
    <complexType name="ServiceStepLines">
	<sequence>
	    <element name="stepLine" minOccurs="0" maxOccurs="unbounded" type="tns:ServiceStepLine" />
	</sequence>
    </complexType>

    <!--
	This type represents a single line associated with a service step
    -->
    <complexType name="ServiceStepLine">
	<sequence>

	    <!-- The ID of the step to which this line extends -->
	    <element name="to" type="string" />

	    <!-- 
		 A string containing a comma-separated list of coordinates through which this line extends.
		 The list of points must contain the first point (coordinate of the "fromPort") 
		 and the last point (coordinate of the "toPort").
	    -->
	    <element name="points" type="string" />
	</sequence>
    </complexType>
    
    
    <!--
	This type contains information related to a running service
    -->
    <complexType name="ServiceRunModel">
	<complexContent>
	    <extension base="pref:Data">
		<sequence>

		    <!-- The status of the service; values: "end" "coach", "error", "debug" -->
		    <element name="serviceStatus" type="string" />

		    <!-- 
			 The ID of the running service or task instance.
			 This is the ID to be used when resuming the service or task.
		    -->
		    <element name="key" type="string" />

		    <!-- The ID of the current step within the context of the running service -->
		    <element name="step" type="string" />

		    <!-- The data (symbol table) associated with the running service -->
		    <element name="data" type="anyType" />

		    <!-- If the service status is "coach", this field contains the coach XML data -->
		    <element name="coach" type="string" />

		    <!-- If the service status is "coach", this field contains a Map of evaluated coach values -->
		    <element name="coachEvals" type="cmn:Map" />

		    <!-- If the service status is "coach", this field contains a list of available actions (end point) -->
		    <element name="actions" type="string" minOccurs="0" maxOccurs="unbounded" />
		    
		     <!-- If the service status is "coach", this field contains a map of actions and associated labels -->
		    <element name="actionsMap" type="cmn:Map" />
		    
		</sequence>
	    </extension>
	</complexContent>
    </complexType>
    
    <complexType name="CoachEval">
        <sequence>
            <element name="ID" type="string" />
	    <element name="value" type="string" />
        </sequence>
    </complexType>
    
    
    <!--    
	 This type represents a list of currently running services
    -->
    <complexType name="CurrentlyRunning">
    	<complexContent>
	    <extension base="pref:Data">
		<sequence>

		    <!-- A list of keys of services that are currently running for the current user -->
		    <element name="instanceIDs" type="string" minOccurs="0" maxOccurs="unbounded" />
		</sequence>
	    </extension>
        </complexContent>
    </complexType>
    

    <!--
	This type represents the result obtained from evaluating a javascript expression
	within the context of a currently running service
    -->
    <complexType name="Result">
    	<complexContent>
	    <extension base="pref:Data">
		<sequence>
		    <element name="result" type="string" minOccurs="0" maxOccurs="1" />
		    <!--
		     Data information stored in an actual Map
		    -->
		    <element name="resultMap" type="cmn:Map" minOccurs="0"/>
		</sequence>
	    </extension>
        </complexContent>
    </complexType>
    
</schema>
+ View example content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bpm:ResponseData xmlns:bpm='http://rest.bpm.ibm.com/v1/data'>
  <status>200</status>
  <data xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:svc='http://rest.bpm.ibm.com/v1/data/service' xsi:type='svc:Result'>
    <result>&quot;100&quot;</result>
  </data>
</bpm:ResponseData>

MIME type: application/x-javascript

Error Response content

Detailed error information.

The default content type is application/json.

MIME type: application/json


+ View schema
{  "description": "WLE Error Response", 
   "type": "object",
   "properties":
   {  "status": {"type": "string",
         "description": "The status of the previous API call."
      },
      "exceptionType": {"type": "string",
         "description": "The classname associated with the exception."
      },
      "errorNumber": {"type": "string",
         "description": "Message ID of the exception."
      },
      "errorMessage": {"type": "string",
         "description": "Message text of the exception."
      },
      "errorMessageParameters": {"type": ["string"], "optional": true,
         "description":"Message text parameters of the exception."
      },
      "programmersDetails": {"type": "object", "optional": true,
         "description":"Additional exception details, for example, a stack trace."
      }
   }
} 

MIME type: application/xml


+ View schema
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://rest.bpm.ibm.com/v1/data/exception"
	elementFormDefault="unqualified" xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:tns="http://rest.bpm.ibm.com/v1/data/exception"
	xmlns:dat="http://rest.bpm.ibm.com/v1/data/root">

    <import schemaLocation="BPMRestData.xsd" namespace="http://rest.bpm.ibm.com/v1/data/root" />
    
    <!--
	This type represents an error response.
    -->    
    <element name="RestRuntimeException">
	<complexType>
	    <sequence>
		<element name="status" type="string"/>
		<element name="Data" type="tns:ExceptionData">
    		</element>
	    </sequence>
	</complexType>
    </element>

    <!-- 
	 This type contains detailed error information associated with an exception.
    -->
    <complexType name="ExceptionData">
	<sequence>
	    <element name="status" type="string"/>

	    <!-- This specifies the java class name of the exception -->
	    <element name="exceptionType" type="string"/>

	    <!-- The message ID of the error message -->
	    <element name="errorNumber" type="string" minOccurs="0"/>

	    <!-- The complete error message -->
	    <element name="errorMessage" type="string"/>

	    <!-- The list of strings inserted into the error message -->
	    <element name="errorMessageParameters" type="string" minOccurs="0" maxOccurs="unbounded"/>

	    <!-- 
		 The stacktrace associated with the exception.
		 Note that this will be omitted unless the "server-stacktrace-enabled" property
		 is enabled in the server's 100Custom.xml file.
	    -->     
	    <element name="programmersDetails" type="string"></element>
	    
	    <!-- Prior responses.  Set if a bulk command was used -->
	    <element name="responses" type="dat:BulkCommandResponses" minOccurs="0"></element>
	</sequence>
    </complexType>
</schema>

MIME type: application/x-javascript

Status codes

The method returns one of the following status codes:
CodeDescription
200 OKSuccess completion.
400 Bad RequestThe parameters are not valid or they are missing.
401 UnauthorizedThe caller is not authorized for this request.
404 Not Found
The task does not exist.
406 Not AcceptableThe requested content type or content encoding is not supported.
500 Internal Server ErrorA severe problem has occurred, programmer's details are provided.

Available since

7.5.1

Parent Topic: Task Instance Resource