Unified Catalog Entity Field Value Count Statistics¶
POST /api/v1/unified_catalog/entity/field_value/count
Overview¶
Count the number of entities corresponding to each value of the specified fields within the current query scope, and return the total count of matched entities.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| fieldList | array | Y | List of fields to be counted. Supports entity basic fields and attributes fields. Allow empty: False Example: ['entityType', 'provider', 'attributes.env'] |
| urn | string | Filter by entity URN exactly. Allow empty: False |
|
| entityType | string | Entity type code. Allow empty: False |
|
| provider | string | Single source type. Allow empty: False |
|
| providers | array | List of source types. Allow empty: False |
|
| search | string | Search keyword, matching urn / name / display_name. Allow empty: False |
|
| filters | json | Filter by attributes fields.Allow empty: False |
Parameter Supplementary Description¶
Request Parameter Description
| Parameter Name | type | Required | Description |
|---|---|---|---|
| fieldList | array[string] | Yes | List of fields to be counted. |
| urn | string | No | Filter by entity URN exactly. |
| entityType | string | No | Filter by entity type. |
| provider | string | No | Single source type. |
| providers | array[string] | No | List of multiple source types. |
| search | string | No | Fuzzy search condition. |
| filters | json | No | Filter by attributes fields. |
fieldList Field Description
- Supports entity basic fields, e.g.,
entityType,provider,urn,name,displayName. - Supports
attributesfields, e.g.,env,project,attributes.env,attributes.project. envis equivalent toattributes.env.
Call Notes
- The
totalCountin the response represents the total number of entities matched by the current filter conditions, unaffected byfieldList. - Array-type attributes will be split into multiple values for separate counting.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/unified_catalog/entity/field_value/count' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"fieldList":["entityType","provider","attributes.env"],"providers":["discovery"]}'
Response¶
{
"code": 200,
"content": {
"totalCount": 1562,
"items": [
{
"field": "entityType",
"values": [
{
"value": "cloud_resource",
"count": 1435
},
{
"value": "service",
"count": 52
}
]
},
{
"field": "env",
"values": [
{
"value": "prod",
"count": 20
}
]
}
]
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-XXXX"
}