# Analytics # Reports ## Table `dns_firewall.analytics.reports.get(strdns_firewall_id, ReportGetParams**kwargs) -> Report` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report` Retrieves a list of summarised aggregate metrics over a given time period. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `account_id: str` Identifier. - `dns_firewall_id: str` Identifier. - `dimensions: Optional[str]` A comma-separated list of dimensions to group results by. - `filters: Optional[str]` Segmentation filter in 'attribute operator value' format. - `limit: Optional[int]` Limit number of returned metrics. - `metrics: Optional[str]` A comma-separated list of metrics to query. - `since: Optional[Union[str, datetime]]` Start date and time of requesting data period in ISO 8601 format. - `sort: Optional[str]` A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `until: Optional[Union[str, datetime]]` End date and time of requesting data period in ISO 8601 format. ### Returns - `class Report: …` - `data: List[Data]` Array with one row per combination of dimension values. - `dimensions: List[str]` Array of dimension values, representing the combination of dimension values corresponding to this row. - `metrics: List[float]` Array with one item per requested metric. Each item is a single value. - `data_lag: float` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `max: object` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `min: object` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `query: Query` - `dimensions: List[str]` Array of dimension names. - `limit: int` Limit number of returned metrics. - `metrics: List[str]` Array of metric names. - `since: datetime` Start date and time of requesting data period in ISO 8601 format. - `until: datetime` End date and time of requesting data period in ISO 8601 format. - `filters: Optional[str]` Segmentation filter in 'attribute operator value' format. - `sort: Optional[List[str]]` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `rows: float` Total number of rows in the result. - `totals: object` Total results for metrics across all data (object mapping metric names to values). ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) report = client.dns_firewall.analytics.reports.get( dns_firewall_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(report.data) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ 0 ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "totals": {} } } ``` # Bytimes ## By Time `dns_firewall.analytics.reports.bytimes.get(strdns_firewall_id, BytimeGetParams**kwargs) -> ByTime` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report/bytime` Retrieves a list of aggregate metrics grouped by time interval. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `account_id: str` Identifier. - `dns_firewall_id: str` Identifier. - `dimensions: Optional[str]` A comma-separated list of dimensions to group results by. - `filters: Optional[str]` Segmentation filter in 'attribute operator value' format. - `limit: Optional[int]` Limit number of returned metrics. - `metrics: Optional[str]` A comma-separated list of metrics to query. - `since: Optional[Union[str, datetime]]` Start date and time of requesting data period in ISO 8601 format. - `sort: Optional[str]` A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `time_delta: Optional[Literal["all", "auto", "year", 7 more]]` Unit of time to group data by. - `"all"` - `"auto"` - `"year"` - `"quarter"` - `"month"` - `"week"` - `"day"` - `"hour"` - `"dekaminute"` - `"minute"` - `until: Optional[Union[str, datetime]]` End date and time of requesting data period in ISO 8601 format. ### Returns - `class ByTime: …` - `data: List[Data]` Array with one row per combination of dimension values. - `dimensions: List[str]` Array of dimension values, representing the combination of dimension values corresponding to this row. - `metrics: List[List[float]]` Array with one item per requested metric. Each item is an array of values, broken down by time interval. - `data_lag: float` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `max: object` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `min: object` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `query: Query` - `dimensions: List[str]` Array of dimension names. - `limit: int` Limit number of returned metrics. - `metrics: List[str]` Array of metric names. - `since: datetime` Start date and time of requesting data period in ISO 8601 format. - `time_delta: Literal["all", "auto", "year", 7 more]` Unit of time to group data by. - `"all"` - `"auto"` - `"year"` - `"quarter"` - `"month"` - `"week"` - `"day"` - `"hour"` - `"dekaminute"` - `"minute"` - `until: datetime` End date and time of requesting data period in ISO 8601 format. - `filters: Optional[str]` Segmentation filter in 'attribute operator value' format. - `sort: Optional[List[str]]` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `rows: float` Total number of rows in the result. - `time_intervals: List[List[datetime]]` Array of time intervals in the response data. Each interval is represented as an array containing two values: the start time, and the end time. - `totals: object` Total results for metrics across all data (object mapping metric names to values). ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) by_time = client.dns_firewall.analytics.reports.bytimes.get( dns_firewall_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(by_time.data) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ [ 0 ] ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "time_delta": "hour", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "time_intervals": [ [ "2023-11-11T12:00:00Z" ] ], "totals": {} } } ```