diff --git a/products/analytics/package.json b/products/analytics/package.json index ea02638c7ca50ec..99aab8aaeef1984 100644 --- a/products/analytics/package.json +++ b/products/analytics/package.json @@ -4,11 +4,11 @@ "cloudflare-docs-engine": "git+https://github.com/cloudflare/cloudflare-docs-engine.git" }, "scripts": { - "bootstrap": "node_modules/cloudflare-docs-engine/bin/commands.sh bootstrap", - "build": "node_modules/cloudflare-docs-engine/bin/commands.sh build", - "develop": "node_modules/cloudflare-docs-engine/bin/commands.sh develop", - "ghactionsbootstrap": "node_modules/cloudflare-docs-engine/bin/commands.sh ghactionsbootstrap", - "savechanges": "node_modules/cloudflare-docs-engine/bin/commands.sh savechanges", - "serve": "node_modules/cloudflare-docs-engine/bin/commands.sh serve" + "bootstrap": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh bootstrap", + "build": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh build", + "develop": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh develop", + "ghactionsbootstrap": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh ghactionsbootstrap", + "savechanges": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh savechanges", + "serve": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh serve" } } diff --git a/products/analytics/src/content/graphql-api/getting-started/authentication/api-key-auth.md b/products/analytics/src/content/graphql-api/getting-started/authentication/api-key-auth.md index fb804d88d76031a..10578760460d55b 100644 --- a/products/analytics/src/content/graphql-api/getting-started/authentication/api-key-auth.md +++ b/products/analytics/src/content/graphql-api/getting-started/authentication/api-key-auth.md @@ -1,6 +1,6 @@ --- title: Authenticate with a Cloudflare API key -order: 20 +order: 30 --- # Authenticate with a Cloudflare API key @@ -9,35 +9,3 @@ API keys are unique to each Cloudflare user and used only for authentication. An * Learn how to [find your API Key](https://support.cloudflare.com/hc/articles/200167836) in the Cloudflare Dashboard * Learn how to [retrieve your API Key](https://api.cloudflare.com/#getting-started-requests) using the Cloudflare API - -## Edit HTTP headers for GraphiQL authentication - -1. Launch _GraphiQL_ - -2. Click **Edit HTTP Headers** - ![ ](../../../static/images/GraphiQL-edit-http-headers.png) - The _Edit HTTP Headers_ window appears. - ![ ](../../../static/images/GraphiQL-edit-http-headers-window.png) - -3. Click **Add Header** - ![ ](../../../static/images/GraphiQL-add-header.png) - -4. Enter **X-AUTH-EMAIL** in the _Header name_ field and your email address registered with Cloudflare in the _Header value_ field, and click **Save** - -5. Click **Add Header** - -6. Enter **X-AUTH-KEY** in the _Header Name_ field, then paste your Global API Key in the _Header value_ field, and click **Save** - ![ ](../../../static/images/GraphiQL-edit-http-headers-complete.png) - -7. Click anywhere outside the _Edit HTTP Headers_ window in _GraphiQL_ to return to the _Untitled Query 1_ tab - -8. Enter `https://api.cloudflare.com/client/v4/graphql` in the _GraphQL Endpoint_ field - ![ ](../../../static/images/GraphiQL-response-pane.png) - - - -Now that you have configured authentication with a Cloudflare API key, you are ready to run queries using _GraphiQL_. diff --git a/products/analytics/src/content/graphql-api/getting-started/authentication/api-token-auth.md b/products/analytics/src/content/graphql-api/getting-started/authentication/api-token-auth.md index 6c090e203851a9c..45e56989e72533c 100644 --- a/products/analytics/src/content/graphql-api/getting-started/authentication/api-token-auth.md +++ b/products/analytics/src/content/graphql-api/getting-started/authentication/api-token-auth.md @@ -1,6 +1,6 @@ --- title: Configure an Analytics API token -order: 30 +order: 20 --- # Configure an Analytics API token @@ -48,7 +48,7 @@ To configure a custom token, follow these steps: ![Create Custom Token page](../../../static/images/create-custom-api-token.png) -1. Use the **Token name** text input to enter a descriptive name for your token. +1. Enter a descriptive name for your token in the **Token name** text input field. 1. To configure access to the GraphQL Analytics API, use the **Permissions** drop-down lists. To set permissions for the GraphQL Analytics API, select _Analytics_ from the second drop-down list. @@ -70,7 +70,7 @@ To configure a custom token, follow these steps: 1. Click **Continue to summary**. -The next section of this walk through shows you how to [review and test your API token](#review-and-test-your-api-token). +The next section of this walkthrough shows you how to [review and test your API token](#review-and-test-your-api-token). ## Review and create your API token @@ -90,11 +90,11 @@ When you create a new token, a confirmation page displays that includes your tok To copy the token to your device's clipboard, click the **Copy** button. - -How can you tell what data sets, metrics, dimensions, operators, and functions are available? One of the great features of a GraphQL API is that it offers "introspection": you can explore the graph (by making API calls) to see the available data sets, the fields and their types, and the operations you can perform. _GraphiQL_ uses this functionality to provide a "Documentation Explorer" that you can use to understand the schema. Click on the _Docs_ link on the right-hand side and then drill down starting with `Query` and proceeding to `viewer` and then `zone`. Introspection is also used to provide query auto-complete and syntax validation. +## Introspection + +The GraphQL API offers [introspection](https://graphql.org/learn/introspection/), which allows you to explore the graph (by making API calls) to see the available data sets, fields, and operations you can perform. + +For an introduction to browsing the Analytics GraphQL API, see [_Explore the Analytics schema with GraphiQL_](/graphql-api/getting-started/explore-graphql-schema). ## Helpful Resources -Handy links for setting up the GraphQL Analytics API and learning about GraphQL. +Here are some helpful articles about working with the Cloudflare Analytics API and GraphQL. ### Cloudflare specific diff --git a/products/analytics/src/content/graphql-api/index.md b/products/analytics/src/content/graphql-api/index.md index 6de48a71dfc03bc..1b35b00de097a32 100644 --- a/products/analytics/src/content/graphql-api/index.md +++ b/products/analytics/src/content/graphql-api/index.md @@ -11,6 +11,16 @@ The basis of the API is the [GraphQL framework](https://graphql.org/), created a GraphQL models a business domain as a graph using a schema. In the schema, there are logical definitions for different types of nodes and their connections (edges). These nodes are the data sets you use for your analytics. You write queries in GraphQL much like in SQL: you specify the data set (table), the metrics to retrieve (such as requests and bytes), and filter or group by dimensions (for example, a time period). +GraphQL differs from a traditional API: it has one single endpoint: + +``` +https://api.cloudflare.com/client/v4/graphql +``` + +You pass the query parameters as a JSON object in the payload of a `POST` request to this endpoint. + +You can use `curl` to make requests to the GraphQL Analytics API. Alternatively, you can use a GraphQL client to construct queries and pass requests to the GraphQL Analytics API. + ## Clients -We are using [_GraphiQL_](https://electronjs.org/apps/graphiql) for our example GraphQL queries. There are many other popular open-source clients that you can find online, such as [_Altair_](https://altair.sirmuel.design) and [_Insomnia_](https://insomnia.rest). Using `curl` is also a possibility. +We are using [_GraphiQL_](https://electronjs.org/apps/graphiql) for our example GraphQL queries. There are many other popular open-source clients that you can find online, such as [_Altair_](https://altair.sirmuel.design) and [_Insomnia_](https://insomnia.rest). diff --git a/products/analytics/src/content/static/images/GraphiQL-edit-http-headers-token.png b/products/analytics/src/content/static/images/GraphiQL-edit-http-headers-token.png new file mode 100644 index 000000000000000..33f219288684895 Binary files /dev/null and b/products/analytics/src/content/static/images/GraphiQL-edit-http-headers-token.png differ diff --git a/products/analytics/src/content/static/images/create-query-fw-data-set-description.png b/products/analytics/src/content/static/images/create-query-fw-data-set-description.png new file mode 100644 index 000000000000000..87e285b8e4b6b38 Binary files /dev/null and b/products/analytics/src/content/static/images/create-query-fw-data-set-description.png differ diff --git a/products/analytics/src/content/static/images/create-query-fw-data-set-field-type.png b/products/analytics/src/content/static/images/create-query-fw-data-set-field-type.png new file mode 100644 index 000000000000000..6da0edc6cf72831 Binary files /dev/null and b/products/analytics/src/content/static/images/create-query-fw-data-set-field-type.png differ diff --git a/products/analytics/src/content/static/images/create-query-fw-data-set-filter.png b/products/analytics/src/content/static/images/create-query-fw-data-set-filter.png new file mode 100644 index 000000000000000..7b1dc48e2854068 Binary files /dev/null and b/products/analytics/src/content/static/images/create-query-fw-data-set-filter.png differ diff --git a/products/analytics/src/content/static/images/create-query-fw-data-set-play.png b/products/analytics/src/content/static/images/create-query-fw-data-set-play.png new file mode 100644 index 000000000000000..c791005c390dfc8 Binary files /dev/null and b/products/analytics/src/content/static/images/create-query-fw-data-set-play.png differ diff --git a/products/analytics/src/content/static/images/create-query-fw-data-set.png b/products/analytics/src/content/static/images/create-query-fw-data-set.png new file mode 100644 index 000000000000000..944e7e1b2af874c Binary files /dev/null and b/products/analytics/src/content/static/images/create-query-fw-data-set.png differ diff --git a/products/analytics/src/content/static/images/docs-fw-data-set.png b/products/analytics/src/content/static/images/docs-fw-data-set.png new file mode 100644 index 000000000000000..6ddb5cb161c71a5 Binary files /dev/null and b/products/analytics/src/content/static/images/docs-fw-data-set.png differ diff --git a/products/analytics/src/content/static/images/docs-fw-fields-list.png b/products/analytics/src/content/static/images/docs-fw-fields-list.png new file mode 100644 index 000000000000000..c30cfb16a626350 Binary files /dev/null and b/products/analytics/src/content/static/images/docs-fw-fields-list.png differ diff --git a/products/analytics/src/content/static/images/docs-query.png b/products/analytics/src/content/static/images/docs-query.png new file mode 100644 index 000000000000000..4fb1ab27349ed89 Binary files /dev/null and b/products/analytics/src/content/static/images/docs-query.png differ diff --git a/products/analytics/src/content/static/images/docs-viewer.png b/products/analytics/src/content/static/images/docs-viewer.png new file mode 100644 index 000000000000000..d5787baef658837 Binary files /dev/null and b/products/analytics/src/content/static/images/docs-viewer.png differ diff --git a/products/analytics/src/content/static/images/docs-zone-filter.png b/products/analytics/src/content/static/images/docs-zone-filter.png new file mode 100644 index 000000000000000..f1c52cbdf91dede Binary files /dev/null and b/products/analytics/src/content/static/images/docs-zone-filter.png differ diff --git a/products/analytics/src/content/static/images/docs-zone.png b/products/analytics/src/content/static/images/docs-zone.png new file mode 100644 index 000000000000000..a019aa000ca0557 Binary files /dev/null and b/products/analytics/src/content/static/images/docs-zone.png differ diff --git a/products/analytics/src/content/static/images/graphiql-base-query.png b/products/analytics/src/content/static/images/graphiql-base-query.png new file mode 100644 index 000000000000000..245005cd1334d8d Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-base-query.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-find-firewall.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-find-firewall.png new file mode 100644 index 000000000000000..f245b332f9c7cf4 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-find-firewall.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-fields.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-fields.png new file mode 100644 index 000000000000000..f75f590edf8bc65 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-fields.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-type-definition.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-type-definition.png new file mode 100644 index 000000000000000..355013ead8ae415 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewall-type-definition.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-firewallevents-definition.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewallevents-definition.png new file mode 100644 index 000000000000000..05a894eedfc3773 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewallevents-definition.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-firewalleventsadaptive.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewalleventsadaptive.png new file mode 100644 index 000000000000000..f1246c27ca7882f Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-firewalleventsadaptive.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-query-mutations.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-query-mutations.png new file mode 100644 index 000000000000000..b4518eb90a7837f Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-query-mutations.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-view-cost.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-view-cost.png new file mode 100644 index 000000000000000..420938e5def6002 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-view-cost.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-viewer-fields.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-viewer-fields.png new file mode 100644 index 000000000000000..75adf189b08d77b Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-viewer-fields.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-zone-fields.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-zone-fields.png new file mode 100644 index 000000000000000..3bb57c04c3468cc Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-zone-fields.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer-zones.png b/products/analytics/src/content/static/images/graphiql-doc-explorer-zones.png new file mode 100644 index 000000000000000..65cc8156d9d2de2 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer-zones.png differ diff --git a/products/analytics/src/content/static/images/graphiql-doc-explorer.png b/products/analytics/src/content/static/images/graphiql-doc-explorer.png new file mode 100644 index 000000000000000..4b51a9bee06ee6a Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-doc-explorer.png differ diff --git a/products/analytics/src/content/static/images/graphiql-docs-link.png b/products/analytics/src/content/static/images/graphiql-docs-link.png new file mode 100644 index 000000000000000..07cb0e061155ce9 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-docs-link.png differ diff --git a/products/analytics/src/content/static/images/graphiql-filter-fields.png b/products/analytics/src/content/static/images/graphiql-filter-fields.png new file mode 100644 index 000000000000000..d13a5cb760fd454 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-filter-fields.png differ diff --git a/products/analytics/src/content/static/images/graphiql-filter-values.png b/products/analytics/src/content/static/images/graphiql-filter-values.png new file mode 100644 index 000000000000000..a8c981f729f0588 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-filter-values.png differ diff --git a/products/analytics/src/content/static/images/graphiql-parameters.png b/products/analytics/src/content/static/images/graphiql-parameters.png new file mode 100644 index 000000000000000..c601607b0f01846 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-parameters.png differ diff --git a/products/analytics/src/content/static/images/graphiql-query-return-field-values.png b/products/analytics/src/content/static/images/graphiql-query-return-field-values.png new file mode 100644 index 000000000000000..e65687e7261e9f3 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-query-return-field-values.png differ diff --git a/products/analytics/src/content/static/images/graphiql-query-variables.png b/products/analytics/src/content/static/images/graphiql-query-variables.png new file mode 100644 index 000000000000000..89a7e043e62e91c Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-query-variables.png differ diff --git a/products/analytics/src/content/static/images/graphiql-return-fields.png b/products/analytics/src/content/static/images/graphiql-return-fields.png new file mode 100644 index 000000000000000..1d1f0d3cfd40f0b Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-return-fields.png differ diff --git a/products/analytics/src/content/static/images/graphiql-set-up-base-query.png b/products/analytics/src/content/static/images/graphiql-set-up-base-query.png new file mode 100644 index 000000000000000..99c97d197689733 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-set-up-base-query.png differ diff --git a/products/analytics/src/content/static/images/graphiql-word-completion.png b/products/analytics/src/content/static/images/graphiql-word-completion.png new file mode 100644 index 000000000000000..ce7bd0d16ca2013 Binary files /dev/null and b/products/analytics/src/content/static/images/graphiql-word-completion.png differ