Search Rules

[POST] /qps/rest/1.0/search/cm/rule/

Returns a list of rules (which are part of rulesets) in the user's account.

Limit your results - Use the optional fields parameter to limit the amount of information returned for each rule. Learn more about limiting your results

Input ParametersInput Parameters

Allowed input elements are listed below. The associated data type for each element appears in parentheses. These elements are optional and act as filters. When multiple elements are specified, parameters are combined using a logical AND.

Click here for available operators

Parameter

Description

id (integer)

The rule ID. This element is assigned by the service.

ruleType (keyword)

The type of rule:

HOST, VULN, PORT, SSL, SW

Sample - Search RulesSample - Search Rules

API request

  
      curl -u "USERNAME:PASSWORD" -H "content-type: text/xml" 
      -X "POST" --data-binary @- "<qualys_base_url>/qps/rest/1.0/search/cm/rule/" 
      < file.xml 

Request POST data

 
      <ServiceRequest>  
      <filters>
         <Criteria field="ruleType" operator="EQUALS">HOST</Criteria>  
      </filters> 
      </ServiceRequest>

Response

 
    <?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="https://qualysapi.qualys.com/qps/xsd/1.
0/cm/rule.xsd">
 <responseCode>SUCCESS</responseCode>
 <count>19</count>
 <hasMoreRecords>false</hasMoreRecords>
 <data>
 <Rule>
 <id>1413</id>
 <ruleType>HOST</ruleType>
 <eventTypes>HOST_FOUND, HOST_UPDATED</eventTypes> 
<jsonData>{&quot;ruleType&quot;:&quot;HOST&quot;,&quot;eventTypes&quot
;:[&quot;HOST_FOUND&quot;
,&quot;HOST_UPDATED&quot;],&quot;criteria&quot;:[{&quot;propertyName&q
uot;:&quot;name&quot;,&quot
;propertyValue&quot;:&quot;blah&quot;,&quot;expressionType&quot;:&quot
;EQUALS&quot;},
{&quot;propertyName&quot;:&quot;operatingSystem&quot;,&quot;propertyVa
lue&quot;:&quot;blah&quot;
,&quot;expressionType&quot;:&quot;EQUALS&quot;},{&quot;propertyName&qu
ot;:&quot;hostname&quot;
,&quot;propertyValue&quot;:&quot;blah&quot;,&quot;expressionType&quot;
:&quot;EQUALS&quot;}]}</jsonData>
 <dateCreated>2018-09-05T16:21:00Z</dateCreated>
 <criteria>
 <list>
 <RuleCriteria>
 <id>1437</id>
 <propertyName>name</propertyName>
 <propertyValue>blah</propertyValue>
 <expressionType>EQUALS</expressionType>
 </RuleCriteria>
 <RuleCriteria>
 <id>1439</id>
<propertyName>operatingSystem</propertyName>
 <propertyValue>blah</propertyValue>
 <expressionType>EQUALS</expressionType>
 </RuleCriteria>
 </list>
 </criteria>
 </Rule>
</data>
</ServiceResponse>

XSDXSD

 <platform API server>/qps/xsd/1.0/cm/rule.xsd