In Maximo you can use End Points to point to External APIs to pull in data. You can invoke those End Points in a variety of ways, including inside an Automation Script. Take the following code as an example:

handler = Router.getHandler('ENDPOINTNAME');
responseBytes = handler.invoke(null, null);

You can then parse the response that comes back and use that data in any way that meets your needs. Recently we were working with an external API that required an initial login to capture an API Key to be used with future calls. We called the Login API and then grabbed an API Key from the response object. We then needed to update a different End Point to utilize this API Key as an HTTP Header in future calls.

This appeared to work in Maximo as we would see the data show up on the updated End Point. However, each time we invoked the End Point it would throw an error that it was not able to connect. We would then restart Maximo and everything would start working. What we found is that End Point data in Maximo is cached. After updating an End Point, we needed to reload the End Point cache to make a successful connection. To do that we added a line in the automation script after we updated and saved the End Point with the new API Key. The line that is needed is:

MXServer.getMXServer().reloadMaximoCache(EndPointCache.getInstance().getName(), true);

After running this code we can now successfully call our updated End Point. Be aware that there are several similar objects that are cached when Maximo starts up, such as Relationships, Integration information, some Domain information, etc. If updates are made to those records, you may need to refresh the Maximo cache for those records as well.

Hope this helps!

Kelly Nimmo is an accomplished Maximo Developer who excels at crafting simple solutions to complex problems. Along with punishing some extremely tough customer problems, Kelly can often be found on the soccer field, demonstrating skills learned as a goalie while at Columbus State University, rejecting foolish attempts to score against her. When Kelly is not at her computer or on the field, she can be found taking orders from her golden retriever pup, Cally, or on the water hunting for the next big fish.

One Thought on “Updating End Points and Reloading Cache in Automation Script”

  • Hi, I know that this question isn’t related, but I would appreciate some help.

    I need to run script or java code on opening record. For example script named ASSET.NEW fires on creating new record, but there is no ASSET.OPEN or something like that.
    As for Java I didn’t find any method that triggers on opening existing record. Every method i override ends up changing every record on list – for example void init(), valueChanged(), modify()…

    Is there any way to achieve this?

    Thank you. Regards

Leave a Reply

Your email address will not be published.