This documentation supports the 19.11 version of BMC CMDB, which is available only to BMC Helix subscribers (SaaS).

To view an earlier version, select the version from the Product version menu.

Running saved queries in web service

While running a saved query, the search results display only the list of root CIs instead of displaying all the related CIs.

When running saved queries, you need to ensure that the input parameter passed in place of the <id> tag should be the unique Id (GUID) of the parameter and not its name. For example, passing "Name" in place of a CI’s name will not give the desired search results because attribute names are not unique. You must pass the Unique Id, instead.

You can retrieve unique Ids by first calling the getSavedQuery web service and then passing that unique Id in the <id> tag. 

An example of a saved query is as shown in the following figure. 

Use the Attribute, Operation, and Id of SavedQueryParameter in ExecuteSavedQuery as shown in the following figure. 


A sample XML is as shown as follows: 

Sample XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://atrium.bmc.com/2010/07/graphquery/types">
   <soapenv:Header>
   <wsse:Security
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <wsse:UsernameToken>
    <wsse:Username>Demo</wsse:Username>
    <wsse:Password
     Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">bmcAdm1n</wsse:Password>
   </wsse:UsernameToken>
  </wsse:Security>
  </soapenv:Header>
<soapenv:Body>
<typ:ExecuteSavedQuery>
<loginInfo>
<locale></locale>
<timeZone></timeZone>
<authentication></authentication>
</loginInfo>
<queryName>TestQuery</queryName>
<parameterValues>
<!--Zero or more repetitions:-->
<list>
<id>DC82AC22-7E79-8776-C02E-6C2513B10F69</id>
<operator>EQUAL</operator>
<rightOperandValue>
<!--You have a CHOICE of the next 17 items at this level-->
<stringValue>Johnny</stringValue>
</rightOperandValue>
</list>
</parameterValues>
<datasetId>BMC.ASSET.SANDBOX</datasetId>
<datasetMask>DATASET_MODE_CURRENT</datasetMask>
<firstRetrieve>0</firstRetrieve>
<maxRetrieve>5</maxRetrieve>
<returnNumMatches>1</returnNumMatches>
<formatType>LIST</formatType>
<extensions>
<!--You may enter ANY elements at this point-->
</extensions>
</typ:ExecuteSavedQuery>
</soapenv:Body>
</soapenv:Envelope>

Related topic

Finding CIs using a saved query


Was this page helpful? Yes No Submitting... Thank you

Comments