Skip to content

Commit d75c0fc

Browse files
[Analytics] Adds footnote about API token and key. (#18036)
* Adds note about API token and key. * Corrections after review. * Changes after review.
1 parent 54daeee commit d75c0fc

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

src/content/docs/analytics/graphql-api/tutorials/end-customer-analytics.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ title: Querying HTTP events by hostname with GraphQL
88

99
In this example, we are going to use the GraphQL Analytics API to query aggregated metrics about HTTP events by hostname over a specific period of time.
1010

11-
The following API call will request the number of visits and edge response bytes for the custom hostname `hostname.example.com` over a four day period. Be sure to replace `CLOUDFLARE_ZONE_ID` AND `API_TOKEN` with your zone ID and API credentials, and adjust the `datetime_geq` and `datetime_leq` values as needed.
11+
The following API call will request the number of visits and edge response bytes for the custom hostname `hostname.example.com` over a four day period. Be sure to replace `CLOUDFLARE_ZONE_TAG` and `API_TOKEN`[^1] with your zone ID and API credentials, and adjust the `datetime_geq` and `datetime_leq` values as needed.
1212

1313
### API Call
1414

@@ -30,7 +30,7 @@ echo '{ "query":
3030
}
3131
}",
3232
"variables": {
33-
"zoneTag": "<CLOUDFLARE_ZONE_ID>",
33+
"zoneTag": "<CLOUDFLARE_ZONE_TAG>",
3434
"filter": {
3535
"datetime_geq": "2022-07-20T11:00:00Z",
3636
"datetime_lt": "2022-07-24T12:00:00Z",
@@ -191,3 +191,5 @@ https://api.cloudflare.com/client/v4/graphql \
191191
}
192192
}' | jq -r 'try .data.viewer.zones[].topPaths[] | "\"\(.dimensions.metric)\": \(.sum.edgeResponseBytes)"' | sort
193193
```
194+
195+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/docs/analytics/graphql-api/tutorials/querying-access-login-events.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ In this example, we are going to use the GraphQL Analytics API to retrieve logs
88

99
The following API call will request logs for a single Access login event and output the requested fields. The authentication request is identified by its **Ray ID**, which you can obtain from the `403` Forbidden page shown to the user.
1010

11-
You will need to insert your API credentials in `<EMAIL>` and `<API_KEY>` and substitute your own values for the following variables:
11+
You will need to insert your `<CLOUDFLARE_ACCOUNT_TAG>`, your API credentials in `<API_TOKEN>`[^1], and substitute your own values for the following variables:
1212

13-
* `accountTag`: Your Cloudflare account ID.
1413
* `rayID`: A unique identifier assigned to the authentication request.
1514
* `datetimeStart`: The earliest event time to query (no earlier than September 16, 2022).
1615
* `datetimeEnd`: The latest event time to query. Be sure to specify a time range that includes the login event you are querying.
@@ -46,7 +45,7 @@ echo '{ "query":
4645
}
4746
}",
4847
"variables": {
49-
"accountTag": "699d98642c564d2e855e9661899b7252",
48+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
5049
"rayId": "74e4ac510dfdc44f",
5150
"datetimeStart": "2022-09-20T14:36:38Z",
5251
"datetimeEnd": "2022-09-22T14:36:38Z"
@@ -103,3 +102,5 @@ Rather than filter by `cfRayId`, you may also [filter](/analytics/graphql-api/fe
103102
```
104103

105104
You can compare the query results to your Access policies to understand why a user was blocked. For example, if your application requires a valid mTLS certificate, Access blocked the request shown above because `mtlsStatus`, `mtlsCommonName`, and `mtlsCertSerialId` are empty.
105+
106+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/docs/analytics/graphql-api/tutorials/querying-firewall-events.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Querying Firewall Events with GraphQL
66

77
In this example, we are going to use the GraphQL Analytics API to query for Firewall Events over a specified time period.
88

9-
The following API call will request Firewall Events over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ZONE_ID>`, `<EMAIL>`, and `<API_KEY>` with your zone tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
9+
The following API call will request Firewall Events over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ZONE_TAG>`, `<EMAIL>`, and `<API_TOKEN>`[^1] with your zone tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
1010

1111
## API Call
1212

@@ -34,7 +34,7 @@ echo '{ "query":
3434
}
3535
}",
3636
"variables": {
37-
"zoneTag": "<CLOUDFLARE_ZONE_ID>",
37+
"zoneTag": "<CLOUDFLARE_ZONE_TAG>",
3838
"filter": {
3939
"datetime_geq": "2022-07-24T11:00:00Z",
4040
"datetime_leq": "2022-07-24T12:00:00Z"
@@ -182,3 +182,5 @@ https://api.cloudflare.com/client/v4/graphql \
182182
#=> "errors": null
183183
#=> }
184184
```
185+
186+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/docs/analytics/graphql-api/tutorials/querying-magic-firewall-ids-samples.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Querying Magic Firewall Intrusion Detection System (IDS) samples with Gra
66

77
In this example, we are going to use the GraphQL Analytics API to query for IDS samples over a specified time period.
88

9-
The following API call will request IDS samples over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_ID>`, `<EMAIL>`, and `<API_KEY>` with your account tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
9+
The following API call will request IDS samples over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_TAG>` and `<API_TOKEN>`[^1] with your account tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
1010

1111
## API Call
1212

@@ -31,7 +31,7 @@ echo '{ "query":
3131
}
3232
}",
3333
"variables": {
34-
"accountTag": "<CLOUDFLARE_ACCOUNT_ID>",
34+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
3535
"filter": {
3636
"datetime_geq": "2023-06-20T11:00:00.000Z",
3737
"datetime_leq": "2023-06-20T12:00:00.000Z",
@@ -101,3 +101,5 @@ https://api.cloudflare.com/client/v4/graphql \
101101
#=> "errors": null
102102
#=> }
103103
```
104+
105+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/docs/analytics/graphql-api/tutorials/querying-magic-firewall-samples.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Querying Magic Firewall Samples with GraphQL
66

77
In this example, we are going to use the GraphQL Analytics API to query for Magic Firewall Samples over a specified time period.
88

9-
The following API call will request Magic Firewall Samples over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_ID>`, `<EMAIL>`, and `<API_KEY>` with your zone tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
9+
The following API call will request Magic Firewall Samples over a one hour period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_TAG>` and `<API_TOKEN>`[^1] with your zone tag and API credentials, and adjust the `datetime_geg` and `datetime_leq` values to your liking.
1010

1111
## API Call
1212

@@ -33,7 +33,7 @@ echo '{ "query":
3333
}
3434
}",
3535
"variables": {
36-
"accountTag": "<CLOUDFLARE_ACCOUNT_ID>",
36+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
3737
"filter": {
3838
"datetime_geq": "2022-07-24T11:00:00Z",
3939
"datetime_leq": "2022-07-24T11:10:00Z"
@@ -106,3 +106,5 @@ https://api.cloudflare.com/client/v4/graphql \
106106
#=> "errors": null
107107
#=> }
108108
```
109+
110+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/docs/analytics/graphql-api/tutorials/querying-workers-metrics.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ products:
88

99
In this example, we are going to use the GraphQL Analytics API to query for Workers Metrics over a specified time period. We can query up to one month of data for dates up to three months ago.
1010

11-
The following API call will request a Worker script's metrics over a one day period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_ID>`, `<EMAIL>`, and `<API_KEY>` with your API credentials, and adjust the `datetimeStart`, `datetimeEnd`, and `scriptName` variables as needed.
11+
The following API call will request a Worker script's metrics over a one day period, and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_TAG>` and `<API_TOKEN>`[^1] with your API credentials, and adjust the `datetimeStart`, `datetimeEnd`, and `scriptName` variables as needed.
1212

1313
## API Call
1414

@@ -41,7 +41,7 @@ echo '{ "query":
4141
}
4242
}",
4343
"variables": {
44-
"accountTag": "<CLOUDFLARE_ACCOUNT_ID>",
44+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
4545
"datetimeStart": "2022-08-04T00:00:00.000Z",
4646
"datetimeEnd": "2022-08-04T01:00:00.000Z",
4747
"scriptName": "worker-subrequest-test-client"
@@ -126,3 +126,5 @@ https://api.cloudflare.com/client/v4/graphql \
126126
#=> "errors": null
127127
#=> }
128128
```
129+
130+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/partials/magic-transit/graphql/query-magic-transit-bandwidth-graphql.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Markdown } from "~/components";
77

88
In this example, you are going to use the GraphQL Analytics API to query {props.productName} ingress tunnel traffic over a specified time period.
99

10-
The following API call will request {props.productName} ingress tunnel traffic over a one-hour period and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_ID>` with your account ID, `<EMAIL>`, `<API_KEY>`, and `<API_TOKEN>` with your API credentials, and adjust the `datetime_geq` and `datetime_leq` values as needed.
10+
The following API call will request {props.productName} ingress tunnel traffic over a one-hour period and output the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_TAG>` with your account ID, `<EMAIL>`, `<API_KEY>`[^1] (legacy) or `<API_TOKEN>`[^2] (preferred method) with your API credentials, and adjust the `datetime_geq` and `datetime_leq` values as needed.
1111

1212
The following example queries for ingress traffic. To query for egress, change the value in the direction filter.
1313

@@ -38,7 +38,7 @@ PAYLOAD='{ "query":
3838
}
3939
}",
4040
"variables": {
41-
"accountTag": "<CLOUDFLARE_ACCOUNT_ID>",
41+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
4242
"direction": "ingress",
4343
"datetimeStart": "2022-05-04T11:00:00.000Z",
4444
"datetimeEnd": "2022-05-04T12:00:00.000Z"
@@ -102,3 +102,6 @@ curl https://api.cloudflare.com/client/v4/graphql \
102102
#=> "errors": null
103103
#=> }
104104
```
105+
106+
[^1]: Refer to [Authenticate with a Cloudflare API key](/analytics/graphql-api/getting-started/authentication/api-key-auth/) for more information.
107+
[^2]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

src/content/partials/magic-transit/graphql/query-magic-transit-health-checks.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Markdown } from "~/components";
77

88
In this example, you are going to use the GraphQL Analytics API to query {props.productName} health check results which are aggregated from individual health checks carried out by Cloudflare servers to Generic Routing Encapsulation (GRE) tunnels you have set up to work with {props.productName} during the onboarding process. You can query up to one week of data for dates up to three months ago.
99

10-
The following API call will request a particular account's tunnel health checks over a one day period for a particular Cloudflare data center, and outputs the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_ID>`, `<EMAIL>`, and `<API_KEY>` with your API credentials, and adjust the `datetimeStart`, `datetimeEnd` variables as needed.
10+
The following API call will request a particular account's tunnel health checks over a one day period for a particular Cloudflare data center, and outputs the requested fields. Be sure to replace `<CLOUDFLARE_ACCOUNT_TAG>` and `<API_TOKEN>`[^1] with your API credentials, and adjust the `datetimeStart`, `datetimeEnd` variables as needed.
1111

1212
It will return the tunnel health check results by Cloudflare data center. The result for each data center is aggregated from the healthchecks conducted on individual servers. The tunnel state field in the value represents the state of the tunnel. These states are used by {props.productName} for routing. The value `0` for the tunnel state represents it being down, the value `0.5` being degraded and the value `1` as healthy.
1313

@@ -37,7 +37,7 @@ echo '{ "query":
3737
}
3838
}",
3939
"variables": {
40-
"accountTag": "<CLOUDFLARE_ACCOUNT_ID>",
40+
"accountTag": "<CLOUDFLARE_ACCOUNT_TAG>",
4141
"datetimeStart": "2022-08-04T00:00:00.000Z",
4242
"datetimeEnd": "2022-08-04T01:00:00.000Z"
4343
}
@@ -96,3 +96,5 @@ https://api.cloudflare.com/client/v4/graphql \
9696
#=> "errors": null
9797
#=> }
9898
```
99+
100+
[^1]: Refer to [Configure an Analytics API token](/analytics/graphql-api/getting-started/authentication/api-token-auth/) for more information on configuration and permissions.

0 commit comments

Comments
 (0)