IBM Support

Maximo JSON mapping - looking for an example?

How To


Summary

Maximo 7.6.0.2 introduced the new JSON API. Included in this API is the ability to use JSON mapping to map JSON data to Maximo XML date. This means you can send JSON data by way of GET or POST methods to a Maximo enterprise service and receive the response in the client in JSON format.
Following in this document is an example of how you can configure the system to receive data in JSON form and respond to a client also in JSON format.

Objective

This document will describe the steps necessary to create a JSON map for an enterprise service that includes a response JSON map, and will show an example of how this will work.

Environment

Maximo 7.6.0.2 and above.

Steps

In the following example, we will set up an enterprise service to use JSON maps for both an inbound request, and a response.
1.  As a first step, set the Maximo property value for mxe.int.keyresponse to 1:
image-20191211090806-2
After applying this change and performing a live refresh, you can ensure  you receive a response to your request.  By default, this will be in XML format and contain the response data from your post to Maximo.
2.  We will be using an object structure included with the Maximo application called MXASSET. 
Also by default this object structure is included in the enterprise service MXASSETInterface.  If you are using a different object structure, you must ensure you create an enterprise service, and add this interprise service to an external system. 
You must add the following process class to your enterprise service in both the Enterprise Service Configuration, and Enterprise Service Response Configuration sections:
com.ibm.tivoli.maximo.fdmbo.JSONMapperExit
See below:
image-20191211095256-4
3.  Enable the enterprise service and external system.  See example below:
image-20191211093714-1
4.  Now we are ready to create our JSON maps  using the JSON Mapping application.  The first map is for the inbound mapping to Maximo, and has a direction of INBOUND.
Click the "New" icon to create a new inbound map.  The map name must be in upper case and have the correct format.  The format of the map name is <extsysname>.<enterpriseservicename>.IN
Ensure that the direction is Inbound.  Optionally, you can add the URL that points to your external systems JSON schema to retrieve the JSON attributes  you will map.  In the following example, the JSON attributes were pasted into the JSON document section manually, as shown below:

Screen Shot 2020-03-10 at 16.41.08

Click the save icon.
Next, click on the Properties tab, where you can map each external attribute to an Maximo attribute name as shown below:
image-20191211094923-3
Save the record.
5.  Now we need to create the outbound JSON Map.  The simplest way to do this is to duplicate your inbound map created above.
The format of the map name is <extsysname>.<enterpriseservicename>.RESPONSE
Ensure that the direction is Outbound.  Optionally, you can add the URL that points to your external systems JSON schema to retrieve the JSON attributes  you will map.  In the following example, the JSON attributes were pasted into the JSON document section manually, as shown below:
Screen Shot 2020-03-10 at 16.52.59
 
Click the save icon.
Next, click on the Properties tab, where you can map each external attribute to an Maximo attribute name as shown below:
Screen Shot 2020-03-10 at 16.54.56
You are now ready to post a transaction using your source JSON attributes, and have them  mapped to valid Maximo attributes, and receive a response in JSON format containing your external system JSON attributes.
In your client, ensure you are setting the http header:  Content-Type:application/json.  Ensure you are passing the correct authentication credentials. 
The URL you can post to in this example is:
http://<hostname>:<port>/meaweb/es/EXTSYS1/MXASSETInterface
The JSON body in this example looks like this:
{
  "BFassetID": "15",
  "BFSiteID": "BEDFORD",
  "BFOrgID": "EAGLENA"
}
You should receive a http 200 response with the body containing your JSON data similar to the following:
{"BFassetID":"15","BFOrgID":"EAGLENA","BFSiteID":"BEDFORD"}

Document Location

Worldwide

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"JSON API","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.6.0.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
03 April 2024

UID

ibm11128297