Maximo Open Forum

 View Only
  • 1.  JSON integration and square brackets

    Posted 17 days ago

    Hi All,

    A quick question, I hope. In version 7.6.1.2, we're using an integration to send JSON to an external system. We can successfully send test data to it, though there is a catch. The external system doesn't like it when Maximo sends the JSON to the system b/c there are no containing square brackets [ { JSON_here } ]. The curly brackets are included as expected. Is there a way to tell Maximo to contain the JSON object in square brackets? Examples below. We'd prefer to avoid a custom exit class or script if possible.

    Thanks,

     

    ****works for external system

    [  <---added square bracket

    {

       "description": "A70X2.5VR 23 - DevTest1619",

             "category": "STK",

             "issueunit": "EA",

             "status": "ACTIVE",

             "catalogcode": "A70X2.5VR-23",

                   "name": "HAUNI RICHMOND INC"

             "vendor": "2-41-RICHMOND"

       "itemnum": "3880072"

    }

    ]  <---added square bracket

    ****what Maximo produces doesn't work for external system (no containing square brackets) - can the square brackets be added?

    {

       "description": "A70X2.5VR 23 - DevTest1619",

             "category": "STK",

             "issueunit": "EA",

             "status": "ACTIVE",

             "catalogcode": "A70X2.5VR-23",

                   "name": "HAUNI RICHMOND INC",

             "vendor": "2-41-RICHMOND",

       "itemnum": "3880072"

    }


    #Administration
    #Customizations
    #Integrations

    ------------------------------
    Rob Radcliff
    JTI Liggett
    ------------------------------


  • 2.  RE: JSON integration and square brackets

    Posted 16 days ago

    That means your receiving system is expecting a JSON array rather than a JSON object. Maximo will use the brackets in array scenarios, such as when you are sending POLINE data inside a PO. But it's not going to define a JSON array when the message is guaranteed to only include a single record. A publish channel fires on a per MBO basis which is why it knows there would only be one. 

    I would be surprised the other system can't handle a JSON object. Sometimes it will be different end points, such as POST to /item if only a single record POST to /items if an array of item records. I would try and review that system to ensure an alternative doesn't exist before trying to make Maximo match it. 

    I'm not aware of a way with settings to force Maximo to use a JSON array here. You would need to adjust the message outbound if it must be an array. I've used functionality like JSON mapping before to adjust the format to match a target system (IE instead of itemnum the JSON needs to be partnumber) but it's still 1:1. I don't know that you could turn it into an array from that.

    User exits on the publish channel are going to be too early in the process where you can override values and such but can't control the destination formatting.

    You might be able to do something with an automation script HTTP handler exit but I don't even know if that's possible. I've only used it for controlling headers/URL. I don't know that you can modify the body there.

    You could definitely control it with your own endpoint automation script but that's not ideal. There are a lot of features in the HTTP handler (like OAuth token management) that would be ideal to take advantage of. If you need to go down this path I would keep your endpoint script as a simple wrapper that still utilizes an HTTP endpoint.



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



  • 3.  RE: JSON integration and square brackets

    Posted 5 days ago

    Hi Steven,

    Thanks for the tip about the receiving system. After a bit more digging, I did find the interface that takes an object rather than an array. 

    I think that we have a bit of work to do with the vendor though. We're sending one inventory item from Item Master with multiple vendors and right now, they don't like that. :)

    Thanks again,



    ------------------------------
    Rob Radcliff
    JTI Liggett
    ------------------------------



  • 4.  RE: JSON integration and square brackets

    Posted 4 days ago

    In 7.6.1.3 the square brackets were introduced: https://moremaximo.com/discussion/outbound-integration-message-change-in-7613#:~:text=%7D-,After%207.6.,cron%20task%20based%20bulk%20export.

    If the vendor can't accept your JSON, the easiest way is an automation script to launch on the External Exit to wrap your payload with [ and ]. The other option is to send to a different endpoint, wrap it with some other middleware, then send to the final destination. Seems more complicated than a simple automation script.



    ------------------------------
    sun kim
    ------------------------------