IBM Support

Using Rest API To Query Multiple Values In A Single Field

Question & Answer


Question

How do you search for multiple values of the same field using the REST API?

Cause

The ormode=1 parameter is used to search for multiple values of the same field.

Answer

Below is an example of how to search for all work orders, using the MXWO object structure, that have a status equal to WAPPR, INPRG, WMATL, or WSCH.
You set "ormode" on the field that you are searching multiple values for as shown at the end of the URL:

maxrest/rest/os/MXWO?status=~eq~appr&status=~eq~wappr&status=~eq~inprg&status=~eq~wmatl&status=~eq~wsch&_maxItems=100&status.ormode=1

The response from the rest call will contain 100 work orders with at least one of the four statuses requested, as shown in the example below.



<QueryMXWOResponse creationDateTime="2017-07-24T15:21:02-04:00" transLanguage="EN" baseLanguage="EN" messageID="2704358.1500924062927949074" maximoVersion="7 6 20161014-1020 V7606-50" rsStart="0" rsTotal="7291" rsCount="3">

<MXWOSet>

<WORKORDER rowstamp="697414">
<SITEID>BEDFORD</SITEID>
<STATUS>APPR</STATUS>
...
<WORKORDER rowstamp="697414">
<SITEID>BEDFORD</SITEID>
<STATUS>INPRG</STATUS>
...
<WORKORDER rowstamp="697414">
<SITEID>BEDFORD</SITEID>
<STATUS>WAPPR</STATUS>
...
</WORKORDER>
</MXWOSet>
</QueryMXWOResponse>


For additional information, contact IBM Support.

[{"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"MEA: Generic","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5;7.6","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Document Information

Modified date:
17 June 2018

UID

swg22006471