The REST Server API uses JSON syntax as the default message format. To use XML, specify the following HTTP request headers.
On response, the Rest Server API includes a Content-Type HTTP header to specify the type of the returned body, if any. If the type is not explicitly specified in the Content-Type header, the UTF-8 is used for encoding of the body.
Each custom XML Media-Type (ending with +xml) the REST API uses is defined using one or more XML schema documents. The corresponding JSON Media-Types (ending with +json) reuses the same schema, which is defined for the XML. The following table describes the XSD documents corresponding to each Media-Type:
Media-Type | Content | Schema |
---|---|---|
application/json application/atom+xml | Defines the Atom Synd objects (Entry, Feed). | http://tools.ietf.org/html/rfc4287 |
application/atomsvc+json application/atomsvc+xml | Defines the Atom Synd objects (Service). | http://tools.ietf.org/html/rfc4287 |
application/com.ibm.di.configuration+json application/com.ibm.di.configuration+xml | Defines the Server Configuration objects. | config/solution.xsd |
application/com.ibm.di.api.server.info+json application/com.ibm.di.api.server.info+xml | Defines the Server API Information objects. | api/server-info.xsd |
application/com.ibm.di.api.server.control+json application/com.ibm.di.api.server.control+xml | Defines the Server API Control objects. | api/server-control.xsd |
application/com.ibm.di.api.server.notification+json application/com.ibm.di.api.server.notification+xml | Defines the Server API Notification objects | api/notification.xsd |
application/com.ibm.di.api.component+json application/com.ibm.di.api.component+xml | Defines the Server API Component objects. | api/component.xsd |
application/com.ibm.di.api.configuration+json application/com.ibm.di.api.configuration+xml | Defines the Server API objects controlling configurations. | api/configuration.xsd |
application/com.ibm.di.api.assembly-line+json application/com.ibm.di.api.assembly-line+xml | Defines the Server API AssemblyLine objects. | api/assembly-line.xsd |
application/com.ibm.di.api.property-store+json application/com.ibm.di.api.property-store+xml | Defines the Server API PropertyStore objects. | api/property-store.xsd |
application/com.ibm.di.api.entry+json application/com.ibm.di.api.entry+xml | Defines the Server API Entry objects. | api/entry.xsd |
application/com.ibm.di.api.listener+json application/com.ibm.di.api.listener+xml | Defines the Server API Listener objects. | api/listener.xsd |
The XML schema defines XML Types that inherit from each other. This schema is useful when defining XML Type hierarchies by using only the base XML Types. In the JSON, an object carries no additional information about the type. The REST Server API requires the property "@type" to specify type of JSON object.
XML content for starting a ConfigInstance
<startCI xmlns="http://www.ibm.com/xmlns/prod/tdi/72/api"
configRef="http://localhost:1098/rest/config/e%3AReadFile"
keepAlive="true"
password="myConfigPasswd"
runName="ReadFile_1">
<logListner>
<pollChannel waitTimeout="60" batchCap="1" />
</logListener>
</startCI>
In this example, the request is for an existing configuration to be started with a new runName and to stay alive when completed. Also, requesting to attach a LogListener when starting the ConfigInstance. The listener uses the Poll Channel that buffers messages on the server side until they are requested by the client. Te actual date is represented in JSON format as shown in the following example.
{
"configRef" : "http://localhost:1098/rest/config/e%3AReadFile",
"keepAlive" : true,
"password" : "myConfigPasswd",
"runName" : "ReadFile_1",
"logListner" : {
"@type" : "logListener",
"channel" : {
"@type" : "pollChannel",
"waitTimeout" : 60,
"batchCap" : 1
}
}
}
The syntax is same as defined in the api/configuration.xsd. However, there are two additional occurrences of the "@type" property, which are not specified by that XSD document.
The"@type" : "logListener" property is specifying that the object is of the same type as the global XML element name ""logListener"". The property name specifies the base type of the property ("LogListener").
On the next "@type" property, you can see that the "channel" property is the local element name and the type is pointing to a base type (the abstract "TransportChannel"). Use the global XML element name as defined in the corresponding XSD ("pollChannel") to specify the type to be used.
There is no "@type" property in the root object. The type of root object is deduced by the operation being started. However, you can use the HTTP Request header "Content-Type" to specify the type of object you are sending. The value of the header is "application/com.ibm.di.api.configuration+json;type=startCI". For type, the global element name is used as defined in the corresponding XSD document.