Count Number of Assets API

Use this API to get the total number of assets.

POST sm/v1/assets/count

Input ParametersInput Parameters

Parameter Mandatory/Optional Data Type Description

query

Optional

string

Filter assets by providing a query using Qualys syntax. Refer to the “How to Search” topic in the online help for assistance.

For example, “agentVersion:5.0.0.17”

groupBy

Optional

string

Group results to fetch count based on values such as agentVersion, agentStatus, and so on.

Sample 1: Get Asset Count by Using agentVersion as the Query ParameterSample 1: Get Asset Count by Using agentVersion as the Query Parameter

API Request

 "curl --location --request GET""https://<qualys_base_url>/sm/v1/assets/count?query=agentVersion:5.0.0.17""\\
--header""'Authorization: <Bearer Token>"

Response

{
   "    ""data":{
      "        ""count":2
    
   },
   "    ""timestamp":"2023-01-19T11:07:35.006Z"
}

Sample 2: Get Asset Count by Using groupBy as the Query ParameterSample 2: Get Asset Count by Using groupBy as the Query Parameter

API Request

 "curl --location --request GET""https://<qualys_base_url>/sm/v1/assets/count?groupBy=operatingSystem""\\
--header""'Authorization: <Bearer Token>"    

Response

 {
   "    ""data":{
      "        ""Microsoft Windows 10 Pro 10.0.19044 64-bit N/A Build 19044":3,
      "        ""CentOS Linux 7.9.2009":1
    
   },
   "    ""timestamp":"2023-01-19T11:14:56.324Z"
}