Skip to content

Unified Catalog Entity Field Value Count



POST /api/v1/unified_catalog/entity/field_value/count

Overview

Counts the number of entities for each value of the specified fields within the current query scope, and returns the total number of matching entities.

Body Request Parameters

Parameter Type Required Description
fieldList array Y List of fields to count, up to 64 items; supports entity base fields and attributes fields
Allow empty: False
$minLength: 1
Max length: 64
Example: ['entityType', 'provider', 'attributes.env']
urn string Exact filter by entity URN
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, matches urn / name / display_name
Allow empty: False
fieldValue string Filter only candidate buckets; can be used together with search — search filters the full entity set first, then fieldValue filters candidate values
Allow empty: False
filters json Attributes field filter
Allow empty: False

Additional Parameter Notes

Request Parameter Description

Parameter Type Required Description
fieldList array[string] Yes List of fields to count, up to 64 items
urn string No Exact filter by entity URN
entityType string No Entity type filter
provider string No Single source type
providers array[string] No List of multiple source types
search string No Fuzzy search condition
fieldValue string No Filter only candidate buckets; can be used together with search — the two act on the full entity set and candidate values respectively
filters json No attributes field filter

fieldList Field Description

  • Supports entity base fields, e.g., entityType, provider, urn, name, displayName.
  • Supports attributes fields, e.g., env, project, attributes.env, attributes.project.
  • env is equivalent to attributes.env.

Calling Notes

  • totalCount in the response indicates the total number of entities matching the current filter conditions, unaffected by fieldList.
  • Array-type attributes are split into separate values for counting.
  • When fieldList or filters involves health fields, entityType must be provided; when the type is disabled, it is counted as unknown/null effective disabled state, without reading historical health values.

Request Example

curl 'https://openapi.guance.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"
} 

Feedback

Is this page helpful?