Skip to main contentCarbon Design System

Object structure query

When retrieving data, the REST API framework provides multiple ways to filter the data returned. Some of the options can be found here: REST API Query Documentation

When the existing options are insufficient, you can utilize an object structure query automation script. For example, if you wanted to retrieve all WOs in an INPRG status that referenced a particular ASSET or LOCATION you would want to generate the following SQL statement:

historyflag=0 and istask=0 and status='INPRG' and (location='BR430' or assetnum='11430')

Until Manage 8.3 or Maximo 7.6.1.3, utilizing the oslc.where would not allow you to combine AND and OR statements in the where clause.

Implicit variables

Variable nameDescription
mbosetThis is the MboSet for the main object of your object structure. You utilize this to set the where clause that gets applied.
  1. Create an Automation Script for Integration. Choose Object Structure, select the object structure in question, and give it a unique Query Name Query Script Creation

  2. Add variables to the script that you want to be provided as query parameters (sqp:variable). These need to be defined as Literal variables with a value, such as * in the example. If the query parameter is not provided, the literal value defined on the script is used. Query Script Variables

  3. Create the query definition for the script. In the Object Structure application, you must add the query “script” type, select the script name, and provide a description.

Example script

def isSet(variable):
return variable and variable!='*'
from psdi.mbo import SqlFormat
query="historyflag=0 and istask=0 "
if isSet(assetnum) and isSet(location):
query+=" and (assetnum=:1 or location=:2) "
elif isSet(assetnum):
query+=" and assetnum=:1 "

Call with a GET request like:

https://myurl.com/maximo/oslc/os/mxapiwodetail?lean=1&oslc.select=wonum,description,siteid&oslc.pageSize=40&savedQuery=OSQUERY.MXAPIWODETAIL.EMXWOFILTER&sqp:assetnum=11430&sqp:location=BR430