Group Asset API

POST/etm/api/rest/v1/assets/group

Use this API to group assets by one or more fields and get aggregated counts for each group.

Input ParametersInput Parameters

Parameter

Mandatory/Optional

Data Type

Description

groupBy

Mandatory

List<String>

Specify the group by criteria.

pageSize

Optional

Integer

Provide the number of records per page to be included in the response.

Default: 20

 

groupByFilter

Optional

String

Provide a filter to be applied after grouping

nestedResult

Optional

Boolean

Specify whether the response should be returned as a nested structure or a flat list.

Default: false

Authorization

Mandatory

String

Authorization token to authenticate to the Qualys Enterprise TruRisk Platform

Prepend the token with "Bearer" and a space.

For example - Bearer authToken

SampleSample

API Request

curl -X POST
'<qualys_base_url>/etm/api/rest/v1/assets/group'
--header 'Authorization: Bearer <JWT Token>'
--header 'Content-Type: application/json'
--data '{
    "query": null,
    "havingQuery": "(( finding.type: Misconfiguration OR finding.typeDetected: [`Confirmed`, `Potential`, `Sensitive Content`] ) and finding.status: [`NEW`, `ACTIVE`, `REOPENED`, `FAIL`] and finding.isIgnored: FALSE)",
    "groupBy": [
        "asset.criticalityScore"
    ]
}'
    

Response

{
  "data": [
    {
      "asset.criticalityScore": 3,
      "count": 68021
    },
    {
      "asset.criticalityScore": 1,
      "count": 44939
    },
    {
      "asset.criticalityScore": 4,
      "count": 2562
    },
    {
      "asset.criticalityScore": 5,
      "count": 2145
    },
    {
      "asset.criticalityScore": 2,
      "count": 2517
    }
  ],
  "totalCount": 5
}