IBM Maximo Asset Management Multitenancy 7.6

Content negotiation of representations

The REST API supports identification of the representation format by using content negotiation as an alternative to using the _format query parameter.

For XML and JSON formats, the supported mimetype values are defined in the following system properties:
Property Value
mxe.rest.format.json.mimetypes application/json
mxe.rest.format.xml.mimetypes application/xml,text/xml

The format is an alias for one or many mime types and is used to identify the serializer for a requested mime type. The REST API uses the Accept HTTP header value for content negotiation. The REST API matches the header value to one of the specified mime types that are defined in the system property. If there is a match, the REST API uses the value as the corresponding format for the response format. If there is no match with the supported format list, an HTTP 406 error code is generated.

The XML and JSON serializers always reply with the values application/xml for the XML representation and application/json for the JSON representation in the Content-Type header property. If you create a serializer to support another format, add your format to the list in the mxe.rest.supportedformats system property.

The values in the mxe.rest.supportedformats system property are related to the values that are provided in individual properties for the corresponding supported mime type values, such as mxe.rest.format.NEW.mimetypes. The mime type values are provided in the request through the Accept header property.

For example, the following system properties are used to add HTML as a resource representation format:

Property Value
mxe.rest.supportedformats html,xml,json,image
mxe.rest.format.html.mimetypes text/html
mxe.rest.mbo.serializer com.ibm.tivoli.maximo.rest.MboHTMLSerializer
mxe.rest.os.serializer com.ibm.tivoli.maximo.rest.OSHTMLSerializer

When the _format parameter and the Accept header property are both provided for a query, the query parameter takes precedence.



Feedback