Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Wrapping an outbound MIF JSON message

    Posted 12/30/25 03:56 PM
    I have a publish channel that is sending an outbound JSON message to an external system's REST API. I need to take the basic Maximo message and wrap it with some metadata. I want the URL and API key in the message to be replaced with a value coming from Maximo system properties.

    What are my options? Can I use the JSON Mapper application? If so, how do you get at the system property values for those fields in the mapping?

    Can I do this with an automation script? I looked at the publish channel external exit script, but it looks like they work with a StructuredData object, and I'm not sure how much control I have over the structure of the message.

    Any feedback, or better yet, examples, would be very helpful! For reference, this is what I'm trying to get a message to look like:

    {
        "targets": [
            {
              "method": "POST",
                "headers":[
                    {
                        "headerKey": "x-api-key",
                        "headerValue": "0d************************************************************59"
                    }
                ],
                "url": "https://externalsys.mydomain.com/updatecue"
            }
        ],
        "payload": {
                "_action": "Replace",
                "_event": true,
                "_id": "ABCD-50047",
                "_translangcode": "EN",

                "description": "CUE description 12:57:32 PM",
                "href": "http:\/\/localhost\/maximo\/oslc\/os\/cuestimate\/_T05FT0svNTAwNDc-",
                "masterwonum": "2025-1001205730",
                "ogslvinitiatedcue": false,
                "orgid": "ONEOK",
                "plusdestcontrolid": 52119,
                "requestnum": "50047",
                "requesttype": "JOB",
                "requesttype_description": "Job WO",
                "siteid": "DISTR",
                "status": "APPR",
                "status_description": "Approved",
                "statusdate": "2025-12-27T16:38:47-06:00"
          }
    }

    -Theo Pozzy


  • 2.  RE: Wrapping an outbound MIF JSON message

    Posted 01/02/26 03:19 PM
    Edited by Andrzej Więcław 01/03/26 04:48 AM

    Hi Theo,

    I believe the simplest way is to use Exits for Publish Channels and develop script which adjusts the external data e.g. as follows:

    var OslcJSONStructureData = Java.type(
        'com.ibm.tivoli.maximo.oslc.provider.OslcJSONStructureData');
    var JSONObject = Java.type('com.ibm.json.java.JSONObject');
    var JSONArray = Java.type('com.ibm.json.java.JSONArray');
    
    var erDataJson = new JSONObject();
    erDataJson.put('targets', JSONArray.parse(JSON.stringify([{ 
        "method": "POST",
        "headers":[
            {
                "headerKey": "x-api-key",
                "headerValue": "0d***59"
            }
        ],
        "url": "https://externalsys.mydomain.com/updatecue"
    }])));
    erDataJson.put('payload', irData.getCurrentJSONData());
    
    erData = new OslcJSONStructureData(
        erDataJson, osName, irData.getObjectPath(),
        userInfo, messageType, false);

    NOTES:

    • For the sake of simplicity I've used JSONArray.parse with native JSON.stringify but you may optimize it further by constructing JSONArray from scratch and avoid serialization/deserialization.
    • The code as-is works fine with the event driven publishing when every primary-MBO is published individually. You may need to slightly adjust it if you need to handle batch exports - for more details inspect com.ibm.tivoli.maximo.oslc.provider.OslcJSONStructureData API).



    ------------------------------
    If this post helps, please consider accepting it as a solution to help other members find it more quickly.

    Andrzej Więcław
    Maximo Technical SME
    ZNAPZ B.V. (part of Naviam)
    Wrocław, Poland
    ------------------------------



  • 3.  RE: Wrapping an outbound MIF JSON message

    Posted 01/05/26 12:29 PM
    Andrzej,

    Thank you for the working example! That approach worked perfectly.

    -Theo