Querying Magic Firewall Samples with GraphQL
In this example, we are going to use the GraphQL Analytics API to query for Magic Firewall Samples over a specified time period.
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, CLOUDFLARE_EMAIL, and CLOUDFLARE_API_KEY with your zone tag and API credentials, and adjust the datetime_geg and datetime_leq values to your liking.
 API Call
The returned values represent the total number of packets and bits received during the five minute interval for a particular rule. The result will be in JSON (as requested), so piping the output to jq will make it easier to read, like in the following example: