Get HTTP requests time series grouped by dimension
Retrieves the distribution of HTTP requests grouped by dimension.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
User Details WriteUser Details ReadParametersExpand Collapse
dimension HTTPTimeseriesGroupsV2ParamsDimensionSpecifies the HTTP attribute by which to group the results.
Specifies the HTTP attribute by which to group the results.
query HTTPTimeseriesGroupsV2Params
Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals. When omitted, the interval is auto-selected from the requested date range; finer intervals are only available for shorter ranges. If the requested interval is too granular for the date range, the request is rejected.
Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals. When omitted, the interval is auto-selected from the requested date range; finer intervals are only available for shorter ranges. If the requested interval is too granular for the date range, the request is rejected.
APITraffic param.Field[[]HTTPTimeseriesGroupsV2ParamsAPITraffic]OptionalFilters results by API traffic classification. API traffic is identified by JSON or XML response content types on dynamic (non-cacheable) HTTP requests. Incompatible with the browserFamily, deviceType, httpProtocol, httpVersion, ipVersion, os, and tlsVersion filters/dimensions. When set, results can only be further filtered by location, continent, or Autonomous System.
Filters results by API traffic classification. API traffic is identified by JSON or XML response content types on dynamic (non-cacheable) HTTP requests. Incompatible with the browserFamily, deviceType, httpProtocol, httpVersion, ipVersion, os, and tlsVersion filters/dimensions. When set, results can only be further filtered by location, continent, or Autonomous System.
Filters results by Autonomous System. Specify one or more Autonomous System Numbers (ASNs) as a comma-separated list. Prefix with - to exclude ASNs from results. For example, -174, 3356 excludes results from AS174, but includes results from AS3356.
BotClass param.Field[[]HTTPTimeseriesGroupsV2ParamsBotClass]OptionalFilters results by bot class. Refer to Bot classes.
Filters results by bot class. Refer to Bot classes.
ContentType param.Field[[]HTTPTimeseriesGroupsV2ParamsContentType]OptionalFilters results by content type category. When set, results can only be further filtered by location, continent, or Autonomous System.
Filters results by content type category. When set, results can only be further filtered by location, continent, or Autonomous System.
Filters results by continent. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude continents from results. For example, -EU,NA excludes results from EU, but includes results from NA.
End of the date range (inclusive). Alternative to dateRange; provide together with dateStart. When requesting comparison series, every series must resolve to the same duration as the main series. Each dateStart/dateEnd is floored to the nearest 15 minutes before evaluation, so windows whose durations match only before alignment may be rejected.
Filters results by relative date range ending at the current time, with each value producing a separate series. Use <n>d for days (up to 364d) or <n>w for weeks (up to 52w). Append control to request the equivalent previous period for comparison: the comparison window is shifted back by the current window’s length rounded up to a whole number of weeks, so it keeps the same weekday alignment and does not overlap the current window (e.g. 7dcontrol covers days -14 to -7, 10dcontrol covers days -24 to -14). For example, pass 7d and 7dcontrol to compare this week with the previous week. All series must resolve to the same duration as the main series; relative ranges (including control) satisfy this automatically. Use this parameter or set specific start and end dates (dateStart and dateEnd parameters).
Start of the date range. Alternative to dateRange; provide together with dateEnd. When requesting comparison series, every series must resolve to the same duration as the main series. Each dateStart/dateEnd is floored to the nearest 15 minutes before evaluation, so windows whose durations match only before alignment may be rejected.
DeviceType param.Field[[]HTTPTimeseriesGroupsV2ParamsDeviceType]OptionalFilters results by device type.
Filters results by device type.
Filters results by Geolocation. Specify a comma-separated list of GeoNames IDs. Prefix with - to exclude geoIds from results. For example, -2267056,360689 excludes results from the 2267056 (Lisbon), but includes results from 5128638 (New York).
HTTPProtocol param.Field[[]HTTPTimeseriesGroupsV2ParamsHTTPProtocol]OptionalFilters results by HTTP protocol (HTTP vs. HTTPS).
Filters results by HTTP protocol (HTTP vs. HTTPS).
HTTPVersion param.Field[[]HTTPTimeseriesGroupsV2ParamsHTTPVersion]OptionalFilters results by HTTP version.
Filters results by HTTP version.
IPVersion param.Field[[]HTTPTimeseriesGroupsV2ParamsIPVersion]OptionalFilters results by IP version (Ipv4 vs. IPv6).
Filters results by IP version (Ipv4 vs. IPv6).
Limits the number of objects per group to the top items within the specified time range. When item count exceeds the limit, extra items appear grouped under an “other” category. Only supported on high-cardinality dimensions; otherwise the request is rejected. Minimum value is 2.
Filters results by location. Specify a comma-separated list of alpha-2 codes. Prefix with - to exclude locations from results. For example, -US,PT excludes results from the US, but includes results from PT.
Normalization method applied to the results. Refer to Normalization methods.
Normalization method applied to the results. Refer to Normalization methods.
TLSVersion param.Field[[]HTTPTimeseriesGroupsV2ParamsTLSVersion]OptionalFilters results by TLS version.
Filters results by TLS version.
ReturnsExpand Collapse
type HTTPTimeseriesGroupsV2Response struct{…}
Meta HTTPTimeseriesGroupsV2ResponseMetaMetadata for the results.
Metadata for the results.
AggInterval HTTPTimeseriesGroupsV2ResponseMetaAggIntervalAggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals.
Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). Refer to Aggregation intervals.
ConfidenceInfo HTTPTimeseriesGroupsV2ResponseMetaConfidenceInfo
Annotations []HTTPTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotation
DataSource HTTPTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsDataSourceData source for annotations.
Data source for annotations.
EventType HTTPTimeseriesGroupsV2ResponseMetaConfidenceInfoAnnotationsEventTypeEvent type for annotations.
Event type for annotations.
Normalization HTTPTimeseriesGroupsV2ResponseMetaNormalizationNormalization method applied to the results. Refer to Normalization methods.
Normalization method applied to the results. Refer to Normalization methods.
Get HTTP requests time series grouped by dimension
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/radar"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.Radar.HTTP.TimeseriesGroupsV2(
context.TODO(),
radar.HTTPTimeseriesGroupsV2ParamsDimensionAdm1,
radar.HTTPTimeseriesGroupsV2Params{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Meta)
}
{
"result": {
"meta": {
"aggInterval": "FIFTEEN_MINUTES",
"confidenceInfo": {
"annotations": [
{
"dataSource": "ALL",
"description": "Cable cut in Tonga",
"endDate": "2019-12-27T18:11:19.117Z",
"eventType": "EVENT",
"isInstantaneous": true,
"linkedUrl": "https://example.com",
"startDate": "2019-12-27T18:11:19.117Z",
"tags": [
"BOT_CLASS"
]
}
],
"level": 0
},
"dateRange": [
{
"endTime": "2022-09-17T10:22:57.555Z",
"startTime": "2022-09-16T10:22:57.555Z"
}
],
"lastUpdated": "2019-12-27T18:11:19.117Z",
"normalization": "PERCENTAGE",
"units": [
{
"name": "*",
"value": "requests"
}
]
},
"serie_0": {
"timestamps": [
"2023-08-08T10:15:00Z"
]
}
},
"success": true
}Returns Examples
{
"result": {
"meta": {
"aggInterval": "FIFTEEN_MINUTES",
"confidenceInfo": {
"annotations": [
{
"dataSource": "ALL",
"description": "Cable cut in Tonga",
"endDate": "2019-12-27T18:11:19.117Z",
"eventType": "EVENT",
"isInstantaneous": true,
"linkedUrl": "https://example.com",
"startDate": "2019-12-27T18:11:19.117Z",
"tags": [
"BOT_CLASS"
]
}
],
"level": 0
},
"dateRange": [
{
"endTime": "2022-09-17T10:22:57.555Z",
"startTime": "2022-09-16T10:22:57.555Z"
}
],
"lastUpdated": "2019-12-27T18:11:19.117Z",
"normalization": "PERCENTAGE",
"units": [
{
"name": "*",
"value": "requests"
}
]
},
"serie_0": {
"timestamps": [
"2023-08-08T10:15:00Z"
]
}
},
"success": true
}