Handling Interactive Logic in Maximo Using the REST APIs
Maximo business logic is filled with Yes/No/Cancell/OK
interactions that needs specific user inputs to execute the corresponding business logic. For this logic to be accessible from REST apis, you need to make the REST API request interactive. By default, all rest requests are not interactive. Therefore, the server side logic chooses the default option and executes the default logic. This may not be desirable in all cases. To allow users choose the options, interactive requests are provided in this API. The following example shows how to make that request:
POST /oslc/os/mxapiwodetail?interactive=1
This marks that request as interactive and now executes the interactive logic on the server side. However, you need to somehow set the desired user input for the interactive logic. To do that you need to set the request header yncuserinput
where the value can be a ;
separated list of name value pairs - each name corresponds to the YesNo
key - for example in the FldWoAssetnum
class one of the interactions is shown:
MXApplicationYesNoCancelException.getUserInput("woassetchange",...
your request header would look like yncuserinput: woassetchange:<value>
where the value is one of
OK = 2 CANCEL = 4 YES = 8 NO = 16 NULL = -1
An example shown below:
yncuserinput: woassetlocation_change:8
If you have YNC nested - like one YNC leads to the other - you can solve all of them by providing the values in sequence - such as:
yncuserinput: woassetlocation_change:8;<someotherkey>:<someothervalue>
A sample YNC response from the rest api would look like below
{"yncuserinputoptions": {"no": "16","yes": "8","close": "1"},"Error": {"errorattrname": "assetnum","extendedError": {
Note that its an error json (as it originated because the server threw an exception - of YNC kind). Also note that the “message” contains the question to the user. Also the “yncuserinputid” contains the id of the YNC interaction. This will be used in the header
yncuserinput
as discussed before.