IBM BPM, V8.0.1, All platforms > Programming IBM BPM > Developing client applications that use IBM BPM REST APIs

Content types supported by the IBM BPM REST APIs

The Content-Type field in the HTTP headers indicates the media type of the data that is sent or returned by the IBM BPM REST API HTTP methods.

The following content types are supported:

Content-Type: application/json

JSON. This is the default response content type. For the detailed format of each returned object, see the JSON schema specifications for each operation.

Content-Type: application/xml)

XML. This is the default format for customer data associated with BPEL processes and task, that is, input, output, or fault data of processes or tasks, or variable data of a process. The format of each expected or returned object is defined in the XML schema provided by the process or task.

Content-Type: application/x-javascript

(BPD-related REST APIs) JSONP. You can use this format as an alternative to JSON. The returned JSON response is wrapped in a JavaScript callback function invocation. If you use this format, you must also specify a callback URI query parameter.
Other MIME types can be used for binary custom properties.


JSON content type and customer data

The BPEL-related REST API methods also provide access to process variable data, and input, output, and fault data of process and task operations. By default, this data is submitted in XML format. Alternatively, it can be submitted in JSON format in request or response messages, however, the following features are not supported in the corresponding XML schema definition:


Support for simple-typed data

Some data objects represent WSDL message parts or BPEL variables that are defined with an XML schema simple type. In this case, a simple-typed value that, for example, is not a valid XML document by itself is wrapped in an XML or JSON element provided by the IBM BPM REST interface.

The following code sample shows the XML wrapper:

<xsd:element name="simpleTypeWrapper" type="tSimpleTypeWrapper"/>
<xsd:complexType name="tSimpleTypeWrapper">
   <xsd:sequence>
      <xsd:element name="value" type="xsd:anySimpleType" nillable="true"/>
   </xsd:sequence>
</xsd:complexType>
Example:
<bpm:simpleTypeWrapper xmlns:bpm="..." xmlns:xsi="..." xmlns:xsd="...">
   <value xsi:type="xsd:integer">42</value>
</bpm:simpleTypeWrapper>

The following code sample shows the JSON wrapper:

{  "description": "Simple Type Wrapper", 
   "type": "object",    "properties":
   {  "value" : {"type": "object", "description": "Simple-typed value."}    } }
Example:
{ "value": 42 }


JSON objects and nested name-value pairs

Some JSON data objects contain a nested object with a list of name-value pairs, such as:

{ "a" : "Athens", "b" : "Belgrade", "c" : "Cairo" }
In the JSON schema descriptions in the REST API reference information, these objects appear generically, for example, {"type":"object"}.


JSONP responses (BPD-related REST APIs only)

To request that response data is to be returned in the JSONP format, you must specify a application/x-javascript response media type using either the Accept HTTP header or the accept URI parameter. You must also specify the JavaScript function name using the callback URI parameter. The response consists of the JSON content wrapped in a JavaScript callback function invocation.

For example:

GET /rest/bpm/wle/v1/task/...?accept=application/x-javascript&callback=mycallback

Because of security considerations, support of JSONP is not enabled by default. To enable JSONP support, set the associated property in the 100Custom.xml file for the process server:

<jsonp-enabled>true</jsonp-enabled> 

Developing client applications that use IBM BPM REST APIs


Related reference:
REST Interface for BPD-related Resources
REST Interface for BPEL-related Process Resources
REST Interface for BPEL-related Task Resources
REST Interface for Federated BPM Resources
HTTP header fields and generic URI parameters