Agent Count

[POST] /qps/rest/2.0/count/am/hostasset

Get the current number of cloud agents installed (provisioned) in the user’s subscription. This count matches the number of agent hosts in the user’s scope.

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

To get a count of agents installed, nothing other than the filter tagName EQUALS Cloud Agent is recommended. The more filters added to the request will result in a more refined count.

Use the following <ServiceRequest> parameters to select agents you want to include in the agent count. These parameters act as filters. When multiple filters are specified, parameters are combined using a logical AND

Filter operators are available for use with <ServiceRequest> parameters.

Supported filter operators

Parameter

Mandatory

/Optional

Data Type

Description

id 

Optional

integer

Asset ID of the agent host.

name 

Optional

string

Asset name of the agent host.

created 

Optional

date

Date when the agent host was added to your asset inventory (i.e. when the agent was provisioned). Date is specified in UTC/GMT format, i.e. YYYY-MM-DD[THH:MM:SSZ]

updated

Optional

date

Date when the agent was last updated, such as activation, host name change, etc. Date is specified in UTC/GMT format.

lastCheckedIn 

Optional

date

Date when the agent last checked in to the cloud platform. Date is specified in UTC/GMT format.

tagName

Mandatory

string

Asset tag name assigned to the agent host. All agent hosts are assigned the tag Cloud Agent.

Sample - Get cloud agent countSample - Get cloud agent count

API request

curl -u fo_username:password -X POST -H "Content-Type: text/xml" -H "Cache-Control: no-cache" --data-binary @get_all_agents_count.xml
"<qualys_base_url>/qps/rest/2.0/count/am/hostasset"
Note: “file.xml” contains the request POST data.      
    

Request POST data

<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
    <filters>
        <Criteria field="tagName" operator="EQUALS">Cloud Agent</Criteria>
    </filters>
</ServiceRequest>      
    

Response

<?xml version="1.0" encoding="UTF-8"?>
<ServiceRespons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="<qualys_base_url>/qps/xsd/2.0/am/hostasset.xsd">
    <responseCode>SUCCESS</responseCode>
    <count>3</count>
</ServiceResponse>
    

XSD

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