{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cisco-catalyst-center/json-schema/cisco-catalyst-center-network-device-energy-query-request-schema.json",
  "title": "NetworkDeviceEnergyQueryRequest",
  "description": "Request object for device energy summaries query request.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cisco-catalyst-center-energy-api-openapi.yml#/components/schemas/NetworkDeviceEnergyQueryRequest",
  "type": "object",
  "properties": {
    "views": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NetworkDeviceEnergyView"
      }
    },
    "attributes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/NetworkDeviceEnergyAttribute"
      }
    },
    "filters": {
      "$ref": "#/$defs/NetworkDeviceEnergyFilters"
    },
    "aggregateAttributes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DevicesEnergyAggregateAttribute"
      }
    },
    "page": {
      "$ref": "#/$defs/NetworkDeviceEnergyPaginationWithAggregateSortBy"
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/startAndEndTime"
    }
  ],
  "$defs": {
    "DeviceEnergyAggregateAttributeKey": {
      "type": "string",
      "description": "Field name on which the aggregate function should be applied when querying the data. The fields supported for aggregation in the API response object are, [energyConsumed, estimatedEmission, estimatedCost, carbonIntensity, deviceCount]",
      "enum": [
        "energyConsumed",
        "estimatedEmission",
        "estimatedCost",
        "carbonIntensity",
        "deviceCount",
        "nuclearEnergyConsumed",
        "geothermalEnergyConsumed",
        "biomassEnergyConsumed",
        "coalEnergyConsumed",
        "windEnergyConsumed",
        "solarEnergyConsumed",
        "hydroEnergyConsumed",
        "gasEnergyConsumed",
        "oilEnergyConsumed",
        "unknownEnergyConsumed",
        "hydroDischargeEnergyConsumed",
        "batteryDischargeEnergyConsumed",
        "renewableEnergyConsumed",
        "nonRenewableEnergyConsumed",
        "fossilEnergyConsumed",
        "fossilFreeEnergyConsumed",
        "energySavings",
        "costSavings",
        "emissionSavings"
      ]
    },
    "DevicesEnergyAggregateAttribute": {
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/DeviceEnergyAggregateAttributeKey"
        },
        "function": {
          "$ref": "#/$defs/Function"
        }
      },
      "description": "Aggregate attribute object for device energy summaries. Name and function supported are in their respective enum objects."
    },
    "Function": {
      "type": "string",
      "description": "Type of aggregate function to apply on the field when querying   data",
      "enum": [
        "sum",
        "min",
        "max",
        "avg",
        "count",
        "latest",
        "distinctCount",
        "median"
      ]
    },
    "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"
      ]
    },
    "NetworkDeviceEnergyAttribute": {
      "type": "string",
      "description": "Field names which are supported by this API as attributes.",
      "enum": [
        "id",
        "deviceName",
        "deviceCategory",
        "deviceSubCategory",
        "siteId",
        "siteHierarchy",
        "siteHierarchyId",
        "energyConsumed",
        "estimatedCost",
        "estimatedEmission",
        "carbonIntensity",
        "nuclearEnergyConsumed",
        "geothermalEnergyConsumed",
        "biomassEnergyConsumed",
        "coalEnergyConsumed",
        "windEnergyConsumed",
        "solarEnergyConsumed",
        "hydroEnergyConsumed",
        "gasEnergyConsumed",
        "oilEnergyConsumed",
        "unknownEnergyConsumed",
        "hydroDischargeEnergyConsumed",
        "batteryDischargeEnergyConsumed",
        "renewableEnergyConsumed",
        "nonRenewableEnergyConsumed",
        "fossilEnergyConsumed",
        "fossilFreeEnergyConsumed",
        "energySavings",
        "costSavings",
        "emissionSavings"
      ]
    },
    "NetworkDeviceEnergyFilter": {
      "type": "object",
      "properties": {
        "key": {
          "$ref": "#/$defs/NetworkDeviceEnergyFilterKey"
        },
        "operator": {
          "$ref": "#/$defs/Operator"
        },
        "logicalOperator": {
          "$ref": "#/$defs/LogicalOperator"
        },
        "value": {
          "type": "object",
          "description": "Field value(s) to filter the data set. Array of values is used for   \"in\" or \"out\" operator. Values will be of whatever type the   specific field being filtered is defined with.\n\nFor other operators, filter value is of whatever type the specific   field being filtered is defined with.\n\nIn the case of an \"and\" or \"or\" operator, this values array will be   ignored, and the values arrays in each of the *nested filters*   will be used.\n"
        },
        "filters": {
          "type": "array",
          "description": "Nested array of filters in case of AND/OR based filters. Only one   level of nesting will be supported.\n\nStructure of nested filter is the same as parent with all operators   supported except AND or OR.\n",
          "items": {
            "$ref": "#/$defs/NetworkDeviceEnergyFilter"
          }
        }
      },
      "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' with a   combination of FilterObj. Filters can be nested to build complex   queries.\n"
    },
    "NetworkDeviceEnergyFilterKey": {
      "type": "string",
      "description": "Field names which are supported by this API for filter keys.",
      "enum": [
        "id",
        "deviceName",
        "deviceCategory",
        "deviceSubCategory",
        "siteId",
        "siteHierarchy",
        "siteHierarchyId"
      ]
    },
    "NetworkDeviceEnergyFilters": {
      "type": "array",
      "description": "List of filters to apply when querying the device energy data.\n\nSupported operators are [in, eq, like]\n",
      "items": {
        "$ref": "#/$defs/NetworkDeviceEnergyFilter"
      }
    },
    "NetworkDeviceEnergyPaginationWithAggregateSortBy": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer",
          "description": "The reference to the limit applied in the Pagination Request."
        },
        "cursor": {
          "type": "string",
          "description": "It's an opaque string field that indicates the next record in the requested collection. If no records remain, the API returns a response with a count of zero. The default value is an empty string, and the initial value must be an empty string. The cursor value is populated by the API in the response page block. If the user wants more records, the cursor in the subsequent request must be updated with the value from the previous response.",
          "default": ""
        },
        "count": {
          "type": "integer",
          "description": "Total number of records related to the resource after applying applicable filtering"
        },
        "sortBy": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NetworkDeviceEnergySortByObj"
          }
        }
      },
      "description": "Pagination model with support for aggregate sort by."
    },
    "NetworkDeviceEnergySortByObj": {
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/NetworkDeviceEnergyAttribute"
        },
        "order": {
          "type": "string",
          "description": "The sort order of the field ascending or descending.",
          "enum": [
            "asc",
            "desc"
          ]
        },
        "function": {
          "$ref": "#/$defs/Function"
        }
      },
      "description": "This is a unified sortBy model for attributes and aggregate attributes request. If function is specified then API will sort the collection on aggregated attribute. If function is not specified API will sort the collection on attribute.\n"
    },
    "NetworkDeviceEnergyView": {
      "type": "string",
      "description": "Views which are supported by this API. Each view represents a specific data set.\n\n### Response data provided by each view:  \n\n1. **device**\n[id, deviceId, deviceCategory, deviceSubCategory]  \n\n2. **site**\n[id, siteId, siteHierarchy, siteHierarchyId]  \n\n3. **energy**\n[id, energyConsumed, estimatedCost, estimatedEmission, carbonIntensity]    \n\n4. **energyMix**\n[nuclearEnergyConsumed, geothermalEnergyConsumed,biomassEnergyConsumed,coalEnergyConsumed,\n  windEnergyConsumed,solarEnergyConsumed,hydroEnergyConsumed\",gasEnergyConsumed,oilEnergyConsumed,unknownEnergyConsumed,hydroDischargeEnergyConsumed,batteryDischargeEnergyConsumed]\nWhen this list is not added the default summaries will be: \n\n**[device, site, energy]**\n",
      "enum": [
        "device",
        "site",
        "energy",
        "energyMix",
        "energySavings"
      ]
    },
    "Operator": {
      "type": "string",
      "description": "Type of filter operator to use for querying data | in and out operator takes multiple values and applies the filters",
      "enum": [
        "in",
        "neq",
        "lt",
        "gt",
        "lte",
        "gte",
        "eq",
        "notIn",
        "like"
      ]
    },
    "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)"
    }
  }
}