IBM Maximo's Integration Framework allows us to customize HTTP Endpoints using Automation Script Call Back Exit methods.
An HTTP Handler Exit is a script-based customization hook that lets us to intercept and modify HTTP requests or responses for Maximo Endpoints.
Below are the supported callback functions and their use cases:
Call Back
Function |
Use Case |
getUrl(req) |
Dynamically
modify the target URL based on environment for example, if you want to append a resource id in the existing URL |
urlProps(req) |
Set URL parameters such as access
key from System property or any record ID like WONUM for
query |
headerProps(req) |
Set
authentication token as header param from an external URL |
processResponse(resp) |
Set Maximo
error for any response code or response body message Read an Unique ID from response and update it in MBO |
req object is implemented by psdi.iface.router.ScriptHTTPReq
resp object is implemented by psdi.iface.router.ScriptHTTPResp
- Create an End point for HTTP handler
- Set HTTPEXIT property to the value script:{script name}, for example, script:HTTPEXIT where HTTPEXIT is an automation script name
- Ensure the script exists as an Automation Script without a launch point.
- Enable the flag "Allow Invoking Script Functions?" to enable call back functions to work in Automation Script. It's editable only at the time of creation.
from psdi.iface.mic import MicUtil from psdi.util import MXApplicationException from com.ibm.json.java import JSON from java.lang import String def urlProps(req): propertyValue = MicUtil.getProperty('mxe.int.customkey') req.addUrlProp('Access-Key',propertyValue) def headerProps(req): req.addHeader('Content-Type','application/json') def getUrl(req): customURL = req.getURL() customURL = customURL + "uniqueID" req.setUrl(customURL) def processResponse(resp): if resp.getResponseCode() > 201: stringData = String(resp.getData(), "UTF-8") respjson = JSON.parse(stringData) params = [respjson["message"]] resp.setError(MXApplicationException('iface','customerrmsg',params)) # iface, customerrmsg maxmessage must be available with {0} as content
References: IBM Maximo Autoscripting Guide – Endpoint script