Search Assets

[POST] /qps/rest/2.0/search/am/asset

Returns a list of assets matching the provided criteria. Assets are returned when they are visible to the user (i.e. in the user’s scope).

Pagination - A maximum of 100 host assets are returned by default. To customize this specify a “preferences” tag in the POST body of your request.

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



Permissions required - Managers with full scope, other users must have these permissions: Access Permission “API Access” and Asset Management Permission “Read Asset”

Input ParametersInput Parameters

Click here for available operators

Parameter

Mandatory

/Optional

Data Type

Description

id

 

integer

 

name

 

text

 

created

 

date

 

updated

 

date

 

type

 

keyword 

UNKOWN, HOST, SCANNER, WEBAPP, MALWARE_DOMAIN

tagName

 

text

Parent tags of the tag will also match

tagId

 

text

Parent tags of the tag will also match

customAttributes.key (available only for CSAM License Subscriber)

 

string

 

customAttributes.value (available only for CSAM License Subscriber)

 

string

 

Sample - Find an asset with a particular tagSample - Find an asset with a particular tag

API request

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

Request POST data

<ServiceRequest>
    <filters>
        <Criteria field="tagName" operator="EQUALS">To Delete</Criteria>
    </filters>
</ServiceRequest>      
    

Response

<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/xsd/2.0/am/asset.xsd">
    <responseCode>SUCCESS</responseCode>
    <count>1</count>
    <hasMoreRecords>true</hasMoreRecords>
    <lastId>5693290</lastId>
    <data>
        <Asset>
            <id>543</id>
            <name>Old Asset (To Delete)</name>
            <created>2014-02-06T19:16:35Z</created>
            <modified>2014-02-06T19:16:35Z</modified>
            <type>HOST</type>
            <tags>
                <list>
                    <TagSimple>
                        <id>12345</id>
                        <name>Tag 1</name>
                    </TagSimple>
                </list>
            </tags>
        </Asset>
    </data>
</ServiceResponse>      
    

Sample - Search asset API returns criticality score for an assetSample - Search asset API returns criticality score for an asset

API request

curl -n -u "USERNAME:PASSWORD" -H "content-type: text/xml"-X "POST" --
"<qualys_base_url>/rest/2.0/search/am/asset" < file.xml
Note: “file.xml” contains the request POST data.      
    

Request POST data

<ServiceRequest>
    <filters>
        <Criteria field="name"
         operator="EQUALS">hkencrtest</Criteria>
    </filters>
</ServiceRequest>      
    

Response

<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/rest/2.0/search/am/asset.xsd">
    <responseCode>SUCCESS</responseCode>
    <count>1</count>
    <hasMoreRecords>false</hasMoreRecords>
    <data>
        <Asset>
            <id>3052446</id>
            <name>hkencrtest</name>
            <created>2020-02-06T09:29:23Z</created>
            <modified>2020-10-27T11:56:50Z</modified>
            <type>HOST</type>
    ...
    
            <criticalityScore>2</criticalityScore>
        </Asset>
    </data>
</ServiceResponse>      
    

Sample - Search Asset using Custom AttributeSample - Search Asset using Custom Attribute

API request

curl -X "POST" '<qualys_base_url>/qps/rest/2.0/search/am/asset' < file.xml
Note: “file.xml” contains the request POST data.      
    

Request POST data

<?xml version="1.0" encoding="UTF-8"?>
<ServiceRequest>
    <filters>
        <Criteria field="id"
         operator="EQUALS">test1</Criteria>
    </filters>
</ServiceRequest>      
    

Response

<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/rest/2.0/am/asset.xsd">
    <responseCode>SUCCESS</responseCode>
    <count>1</count>
    <hasMoreRecords>false</hasMoreRecords>
    <data>
        <Asset>
            <id>3052446</id>
            <name>test1</name>
            <created>2020-02-06T09:29:23Z</created>
            <modified>2020-10-27T11:56:50Z</modified>
            <type>HOST</type>
            <tags>
                <list>
                    <TagSimple>
                        <id>xxxxxx</id>
                        <name>update-ats-847-specific-ag-bu</name>
                    </TagSimple>
                </list>
            </tags>
            <customAttributes>
                <list>
                    <CustomAttribute>
                        <key>department</key>
                        <value>Engineering
                        </key>
                    </CustomAttribute>
...
          
                </sourceInfo>
                <criticalityScore>5</criticalityScore>
            </Asset>
        </data>
    </ServiceResponse>
</Asset>undefined</data>undefined</ServiceResponse>      
    

XSD

<platform API server>/qps/xsd/2.0/am/asset.xsd