{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cisco-catalyst-center/json-schema/cisco-catalyst-center-dhcpservices-top-nanalytics-request-schema.json",
  "title": "DHCPServicesTopNAnalyticsRequest",
  "description": "DHCP Services Top N Analytics requst payload",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cisco-catalyst-center-dhcp-services-api-openapi.yml#/components/schemas/DHCPServicesTopNAnalyticsRequest",
  "required": [
    "groupBy",
    "topN"
  ],
  "type": "object",
  "properties": {
    "topN": {
      "$ref": "#/$defs/topN"
    },
    "groupBy": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DHCPServicesAnalyticsGroupByKey"
      }
    },
    "filters": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DHCPServicesAnalyticsFilter"
      }
    },
    "attributes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DHCPServicesAnalyticsAttributeKey"
      }
    },
    "aggregateAttributes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DHCPServicesAggregateAttribute"
      }
    },
    "page": {
      "$ref": "#/$defs/DHCPServicesAnalyticsPaginationRequest"
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/startAndEndTime"
    }
  ],
  "$defs": {
    "DHCPServicesAggregateAttribute": {
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/DHCPServicesAggregateAttributeKey"
        },
        "function": {
          "$ref": "#/$defs/NetworkServicesFunction"
        }
      }
    },
    "DHCPServicesAggregateAttributeKey": {
      "type": "string",
      "enum": [
        "transactions",
        "failedTransactions",
        "successfulTransactions",
        "latency",
        "discoverOfferLatency",
        "requestAcknowledgeLatency"
      ]
    },
    "DHCPServicesAnalyticsAttributeKey": {
      "type": "string",
      "enum": [
        "deviceSiteHierarchy",
        "deviceName",
        "deviceFamily",
        "successRate",
        "failureRate"
      ]
    },
    "DHCPServicesAnalyticsFilter": {
      "type": "object",
      "properties": {
        "key": {
          "$ref": "#/$defs/DHCPServicesAnalyticsFilterAttribute"
        },
        "operator": {
          "$ref": "#/$defs/NetworkServicesOperator"
        },
        "logicalOperator": {
          "$ref": "#/$defs/LogicalOperator"
        },
        "value": {
          "type": "object",
          "description": "Field value(s) to filter the data set.\n"
        },
        "filters": {
          "type": "array",
          "description": "This nested array of filters can be used when `logicalOperator` is used.\n",
          "items": {
            "$ref": "#/$defs/DHCPServicesAnalyticsFilter"
          }
        }
      },
      "description": "In case of single filter, please use `key`, `operator` and `value` combination. If multiple filters need to be applied using a logical   operation, please use `logicalOperator` and populate the list of `filters`. Filters can be nested to build complex queries.\n"
    },
    "DHCPServicesAnalyticsFilterAttribute": {
      "type": "string",
      "description": "Field names which are supported by this API as filter keys",
      "enum": [
        "serverIp",
        "deviceId",
        "deviceName",
        "deviceSiteHierarchy",
        "deviceSiteId",
        "deviceSiteHierarchyId"
      ]
    },
    "DHCPServicesAnalyticsGroupByKey": {
      "type": "string",
      "enum": [
        "serverIp",
        "deviceId",
        "deviceSiteId"
      ]
    },
    "DHCPServicesAnalyticsPaginationRequest": {
      "type": "object",
      "properties": {
        "limit": {
          "minimum": 1,
          "type": "integer",
          "description": "Number of records to be returned in response",
          "default": 100
        },
        "offset": {
          "minimum": 1,
          "type": "integer",
          "description": "Starting offset of data to fetch and returned",
          "default": 1
        },
        "sortBy": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DHCPServicesAnalyticsSortBy"
          }
        }
      }
    },
    "DHCPServicesAnalyticsSortBy": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Field name on which the data should be sorted",
          "enum": [
            "serverIp",
            "deviceName",
            "deviceSiteHierarchy",
            "deviceFamily",
            "successRate",
            "failureRate",
            "transactions",
            "failedTransactions",
            "successfulTransactions",
            "latency",
            "discoverOfferLatency",
            "requestAcknowledgeLatency"
          ]
        },
        "function": {
          "$ref": "#/$defs/NetworkServicesFunction"
        },
        "order": {
          "type": "string",
          "description": "Sort order. 'asc' for ascending and 'desc' for descending",
          "enum": [
            "asc",
            "desc"
          ]
        }
      },
      "description": "Records are sorted based on the field specified."
    },
    "LogicalOperator": {
      "type": "string",
      "description": "Operator to use when attempting to apply a logical conjunction of more   than 1 filter\n\nLogical operations include: 'and', 'or'.\n",
      "enum": [
        "and",
        "or"
      ]
    },
    "NetworkServicesFunction": {
      "type": "string",
      "description": "Name of the aggregate function that should be applied when querying the data.",
      "enum": [
        "sum",
        "min",
        "max",
        "avg",
        "latest"
      ]
    },
    "NetworkServicesOperator": {
      "type": "string",
      "description": "Type of filter operator to use for querying data. When `in` and `notIn` operators are used, the `value` should be array. For all other operators, the `value` should be a single value.",
      "enum": [
        "in",
        "eq",
        "like",
        "lt",
        "lte",
        "gt",
        "gte"
      ]
    },
    "startAndEndTime": {
      "type": "object",
      "properties": {
        "startTime": {
          "type": "integer",
          "description": "Start time from which the API queries the dataset related to the resource. It must be specified in terms of milliseconds since UNIX epoch. Value is inclusive.\n\nIf `startTime` is not provided, API will default to current time.\n",
          "format": "int64"
        },
        "endTime": {
          "type": "integer",
          "description": "End time to which the API queries the dataset related to the resource. It must be specified in terms of milliseconds since UNIX epoch. Value is inclusive.\n\nIf `endTime` is not provided, API will default to current time.\n",
          "format": "int64"
        }
      },
      "description": "start and end time of data set to query. Data is aggregated   based on time window and timestamped with window start time. | For example - 1. When data events falls in a 5 minute window from 12-13-2023 11:25 PM to 12-13-2023 11:30 PM the timestamp of the aggregated data is 12-13-2023 11:25 PM - 1702509900000 (Unix epochtime). If user needs data from 12-13-2023 11:25 PM to 12-13-2023 11:30 PM user must use below timestamps | startTime = 1702509900000 (12-13-2023 11:25 PM) | endTime = 1702510199000 (12-13-2023 11:29:59 PM) | 2. When data to be queried is for 3 hours period from 12-13-2023 08:30 PM to 12-13-2023 11:30 PM. User must use below timestamps | startTime = 1702528200000 (12-13-2023 08:30 PM) | endTime = 1702510199000 (12-13-2023 11:29:59 PM) | 2. When data to be queried is for 24 hours period from 12-12-2023 11:30 PM to 12-13-2023 11:30 PM. User must use below timestamps | startTime = 1702423800000 (12-12-2023 11:30 PM) | endTime = 1702510199000 (12-13-2023 11:29:59 PM) | 3. When data to be queried is for 7 days period from 12-06-2023 11:30 PM to 12-13-2023 11:30 PM. User must use below timestamps | startTime = 1701905400000 (12-06-2023 11:30 PM) | endTime = 1702510199000 (12-13-2023 11:29:59 PM)"
    },
    "topN": {
      "maximum": 100,
      "minimum": 5,
      "type": "integer",
      "description": "Number of records to retrieve",
      "default": 5,
      "enum": [
        5,
        10,
        50,
        100
      ]
    }
  }
}