Category: MIF

How to post HTTP requests using Automation script?

I want to post a simple JSON message to an external system and do not want to add any external library to Maximo as it would require a restart.

In the past, I used the Java HTTPClient library that comes with Maximo, but it would require half a page of boilerplate Jython code. Recently, I found a simpler solution below.

Step 1

First I use WebHook as a mock service for testing. Go to webhook.site, it will give us a unique URL to send request to:

    Step 2

    Go to the End Point application in Maximo to create a HTTP Endpoint

    • End Point Name: ZZWEBHOOK
    • Handler: HTTP
    • Headers: Content-Type: application/json
    • URL: <copy/paste the Unique URL from webhook>
    • HttpMethod: POST

    Step 3

    To ensure it’s working, Use the Test button, write some simple text, then click on “TEST”. Maximo should show a successful result. In Webhook, it should also show a new request received. (Note: if it gives an error related to SSL, it’s because Websphere doesn’t trust the target website. You’ll need to add the certificate of the target website to Websphere trust store)

    Step 4

    To send a request, just need two lines of code as follows:

    Update: For a more advanced query requirement, please refer to this new post: Send HTTP Request from Automation Script

    IBM App Connect – Integrate Maximo with Google Sheet, SalesForce, and ServiceNow

    While having a break between projects, I have some free time to play around with IBM’s new toy: App Connect. After several years of working with Enterprise applications, I’ve got to a point where I can tell if a system is great or not after playing around with it for a short time.  Some examples of great systems or platforms I have experience with is Maximo (of course), React Native (for mobile development), and SAP. Some examples of *not so great* systems I played with include Oracle EBS, Infor SunSystems, and Maximo Anywhere mobile platform.
    With App Connect, I can tell this is an excellent tool after going through a few beginner tutorials. I can immediately come up with some useful use case using it to enhance Maximo by integrating it with other cloud applications. Below are two examples:
    1 – Using shared Google Sheets to collect project data such as Asset register, Spare-part BOM from vendors:
    An operator can create different Google Sheets and then share them with EPC contractor or sub-contractor, asking them to copy/paste data from their internal design database, and the data will be sent over to Maximo automatically. This continuous data provision process will ensure a more complete and accurate asset database after the system is handed over to the operator.

    2 – Linking Maximo with a Service Provider’s CRM or ticketing system to automate Service Request workflow: 

    Obviously, companies have been integrating Maximo with other systems in similar scenarios for ages, but with App Connect, the implementation is so much simpler and effortless. The above scenarios took me less than 10 minutes to configure everything without writing a single line of code. For an enterprise-grade integration solution, which needs to be robust, secure, and has high performance, it will take a lot more effort than that, but surely, it will not take weeks or months using traditional methods which involve coding. This is great news for companies that need to react fast to changing processes.
    I haven’t looked into details on the cost of this solution, but IBM’s cost model charging is based on the volume of messages exchanged via App Connect. It will be relatively cheap and easy to get started. The cost will only increase as you scale up your operation. For small operators which only need to send out a few hundred tickets a month, I guess they can even get away with the free Lite plans. So this is definitely worth considering.

    Hope you enjoy it.

    How to bulk upload images via the Integration Framework?

    In the previous post, I provided an example of how we can customise Object Structure to enable import/export of binary data via MIF. It is achieved with Java customisation. From Maximo version 7.6, the automation scripting framework has been greatly extended to support integration. With this update, we can enable import/export of binary data with a simple automation script. Below is an example of how we can configure Maximo 7.6 to bulk upload images to Item Master application:

    Step 1: Add a new Object Structure

    • In the Object Structures application, Open and duplicate the MXITEM object structure to create a new one. Name it MXLITEM
    • Under “Source Objects for MXITEM”, delete all child objects, and add a new child object IMGLIB as shown below

    Step 2: Add an Integration Automation Script

    • In the Automation Script application, choose Action > Create > Script for Integration
    • In the pop-up, enter the following  details:
      • Select “Object Structure”, choose “MXLITEM” for Object Structure
      • Select “Inbound Processing
      • Language: Python
      • Copy/paste the piece of code below to the  Source Code area.

    Step 3: Upload images to Item Master

    Download the Excel VBA tool in this GitHub repo. Use it bulk upload images to Item Master:

    • Upload the Settings page with the URL and the username/password to connect to Maximo
    • Put all the image files in the same folder as the Excel file
    • Update the Data sheet with the list of Item Number and the name of the image file.
    • Click on “Upload Images”

    Notes & Updates

    Note 1: be careful with photos taken from newer cameras, the files usually have high resolution and thus can be quite big. I’ve seen an eager team of engineers upload images for all assets and inventory items in a power plant, and overnight, the database grew from 1GB to 20 GB. Thus make sure you resize the images before uploading.

    One quick and simple method in Windows is to select multiple files, then right-click, and choose Send To > Mail Recipient. Windows will give you a pop-up to resize the files, choose the smallest size (640×480). Windows will resize the files, then attach them to Outlook, in Outlook, select all the files, and copy/paste them to a different folder. These files will be much smaller than the original, full-resolution files.

    Update Aug/2023: I have posted a new article on how to automatically rescale the image to a smaller size

    Import/Export Maximo ImageLib Data via Integration Framework

    In Maximo, we can upload images as attachments (DOCLINKS) which are stored as files on the server or as “profile” images which are stored as binary data inside the IMAGELIB table. Profile image is quite useful to give the user a quick view of what an inventory item or an asset/location looks like.

    While Maximo allows us to upload DOCLINKS attachments via the Maximo Integration Framework (MIF), uploading images to the IMAGELIB table via MIF is not supported out-of-the-box. Therefore, to upload images, we can only do it manually one by one via the Maximo UI.

    For bulk loading, if we have access to the DB server, we can write a stored procedure to read the files and import binary data directly to the database. There are two scenarios I had in the past in which this
    approach doesn’t work

    • When we built mobile apps and wanted to upload data to IMAGELIB. In that case, my teammate extended a REST handler class to achieve this requirement.
    • When we needed to bulk upload images, the client did not give us access to the database

    To address this requirement, we can extend the process classes of object structure (OS) to encode/decode binary data into Base64 string to deliver the data via XML or JSON format. Since this processing is done on object structure, it will support both application Import/Export and sending/receiving binary data via the integration framework’s MEAWEB API or JSON API.

    To encode binary data to Base64 text string before exporting OS data, we can extend MicSetOut.class and associate it to the OS by specifying the class’s path in the “Outbound Definition Class” field. Below is the sample Java code which exports Item master data with Image:

    To decode base64 string back to binary data before storing it to IMAGELIB table, we can extend the MicSetIn.class and associate it to the OS by specifying the class’s path in the “Inbound Processing Class” field. Below is the sample Java code:

    Once we have the customized classes in place, it is possible to Export/Import ImageLib data using XML format or via web services. It is also quite easy to write a simple Excel/VBA program to bulk upload images via MIF without the need to have direct access to the DB server. But these are different topics and perhaps, I’ll provide examples in other future posts.