IBM Maximo Asset Management Multitenancy 7.6

_format and _compact parameters

The REST API supports XML and JSON representations (formats). You can use the _format parameter or content negotiation to specify a resource representation. You can use the _compact parameter to specify compact JSON format.

If a request does not specify a format, the default representation is used. The default is defined by the mxe.rest.mbo.defaultformat system property.

If a request specifies the _format parameter, the value is validated against the list of supported formats in the mxe.rest.supportedformats system property. If the requested format matches one of the supported formats, the requested format is used as the response format. If the requested format does not match the supported format list, an HTTP 406 error code is generated.

The _compact Boolean query parameter applies to the JSON format when the formatted response can be returned in a compact style. The structure of the response data is simplified and no metadata is returned for individual field values.

Example: Specifying JSON representation

The following request is for an Asset object in JSON representation:

GET  /maxrest/rest/mbo/asset/123?_format=json

The following response is returned:

{

  ASSET: {

    Attributes: {

      ASSETNUM: {
      content: "11200"
      }

      SERIALNUM: {
      content: "3481-52"
      }

      ASSETTAG: {
      content: "3751"
      }

      LOCATION: {
      content: "BR200"
      }

      DESCRIPTION: {
      content: "HVAC System- 50 Ton Cool Cap/ 450000 Btu Heat Cap"
      }

Example: Specifying compact format

The following request specifies compact format:

GET /maxrest/rest/mbo/asset/123?_format=json&_compact=1

This following response is returned:

{

  ASSET: {
    ASSETNUM: "11200"
    SERIALNUM: "3481-52"
    ASSETTAG: "3751"
    LOCATION: "BR200"
    DESCRIPTION: "HVAC System- 50 Ton Cool Cap/ 450000 Btu Heat Cap"
    VENDOR: "TRN"
    MANUFACTURER: "TRN"
    .
    .


Feedback