Skip to content
Start here

Table

client.DNSFirewall.Analytics.Reports.Get(ctx, dnsFirewallID, params) (*Report, error)
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 for detailed information about the available query parameters.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
DNS Firewall WriteDNS Firewall Read
ParametersExpand Collapse
dnsFirewallID string

Identifier.

maxLength32
params AnalyticsReportGetParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
Dimensions param.Field[string]Optional

Query param: A comma-separated list of dimensions to group results by.

Filters param.Field[string]Optional

Query param: Segmentation filter in ‘attribute operator value’ format.

Limit param.Field[int64]Optional

Query param: Limit number of returned metrics.

Metrics param.Field[string]Optional

Query param: A comma-separated list of metrics to query.

Since param.Field[Time]Optional

Query param: Start date and time of requesting data period in ISO 8601 format.

formatdate-time
Sort param.Field[string]Optional

Query param: A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).

Until param.Field[Time]Optional

Query param: End date and time of requesting data period in ISO 8601 format.

formatdate-time
ReturnsExpand Collapse
type Report struct{…}
Data []ReportData

Array with one row per combination of dimension values.

Dimensions []string

Array of dimension values, representing the combination of dimension values corresponding to this row.

Metrics []float64

Array with one item per requested metric. Each item is a single value.

DataLag float64

Number of seconds between current time and last processed event, in another words how many seconds of data could be missing.

minimum0
Max unknown

Maximum results for each metric (object mapping metric names to values). Currently always an empty object.

Min unknown

Minimum results for each metric (object mapping metric names to values). Currently always an empty object.

Query ReportQuery
Dimensions []string

Array of dimension names.

Limit int64

Limit number of returned metrics.

Metrics []string

Array of metric names.

Since Time

Start date and time of requesting data period in ISO 8601 format.

formatdate-time
Until Time

End date and time of requesting data period in ISO 8601 format.

formatdate-time
Filters stringOptional

Segmentation filter in ‘attribute operator value’ format.

Sort []stringOptional

Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).

Rows float64

Total number of rows in the result.

minimum0
Totals unknown

Total results for metrics across all data (object mapping metric names to values).

Table

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/dns_firewall"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  report, err := client.DNSFirewall.Analytics.Reports.Get(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    dns_firewall.AnalyticsReportGetParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", report.Data)
}
{
  "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": {}
  }
}
Returns Examples
{
  "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": {}
  }
}