Maximo Open Forum

 View Only
  • 1.  Convert object structure to JSON data

    Posted 28 days ago

    Hello everyone
    It is necessary to send JSON data to the corresponding system through POST request in the automation script, whether there is a method to obtain the configured object structure, convert the object structure to JSON, and push it to the target system


    #Administration

    ------------------------------
    Ethan Williams
    secrecy
    ------------------------------


  • 2.  RE: Convert object structure to JSON data

    Posted 14 days ago

    Whenever possible, you want to use the publish channel framework for this rather than directly sending in an automation script. If the other system is down for any reason, or the SSL certificate is changed and needs to be imported, or an error is thrown by the receiving system, you prevent yourself from being able to identify and correct the issue. It's rare for integrations to be truly fire and forget (your organization doesn't depend upon a message being delivered). Publish channels utilize queues and provide the more robust error handling.

    Depending on your version, Maximo supports publish channels sending as JSON when you enable the flag on the publish channel. You can also use an application called JSON Mapping to transform the message from the Maximo format to a format required by the receiving system. Some high level information on publish channels can be found here: Publish channels - IBM Documentation

    It will depend on your version but if you're absolutely adamant that you want to serialize a MBO to object structure JSON without utilizing the traditional integration framework, you could do something like this:

    from com.ibm.tivoli.maximo.oslc import OslcUtils
    jsonBody=OslcUtils.serializeResourceAsObject(woMbo, "MXAPIWODETAIL", None, False)

    The woMbo you would replace with whatever has your MBO data. The MXAPIWODETAIL is the object structure you want to utilize to serialize as. The third parameter is a query template to use and is optional. The last is whether you want to retain MBOs (IE leave the data in memory after publish channel is complete) and should often be false. 



    ------------------------------
    Steven Shull
    Naviam
    ------------------------------



  • 3.  RE: Convert object structure to JSON data

    Posted 14 days ago

    Thank you, Steven, for sharing your expertise and detailed explanation.


    Your point about prioritizing the publish channel framework over direct automation scripts provides valuable insight into the design logic behind Maximo integrations, particularly regarding robustness and error handling. The code example for JSON serialization of MBOs also clearly demonstrates the technical implementation details and version considerations. This information is highly beneficial for exploring Maximo integration solutions in the future, especially when balancing flexibility with stability.



    ------------------------------
    Ethan Williams
    secrecy
    ------------------------------