Skip to content

Commit 7089045

Browse files
committed
PCX-1086 Fix article on exploring schema
1 parent 823e66d commit 7089045

File tree

2 files changed

+45
-19
lines changed

2 files changed

+45
-19
lines changed

products/analytics/src/content/graphql-api/getting-started/explore-graphql-schema.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,61 @@ title: Explore the GraphQL schema
33
order: 40
44
---
55

6-
# Explore the GraphQL schema in the GraphQL client
6+
# Explore the GraphQL schema in the GraphiQL client
7+
8+
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.
9+
10+
_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.
711

812
You can explore the schema of the Coudflare GraphQL endpoint in the the GraphQL client. The examples below use the GraphiQL client.
913

1014
Before you begin, configure the API endpoint and HTTP headers in the GraphQL client.
1115

12-
Click **Docs** to open the _Documentation Explorer_ pane.
16+
## Use the Documentation Explorer
17+
18+
Click **Docs** to open the **Documentation Explorer** pane.
1319

1420
A list of available nodes displays. The nodes in the list follow this syntax:
1521

1622
```
1723
node-name: node-type-definition
1824
```
1925

20-
Click on the _type definition_ of a node to view the fields that it provides. The _Documentation Explorer_ pane also displays descriptions of the nodes.
26+
## Find the type definition of a node
2127

22-
When you first open the _Documentation Explorer_ pane, the **mutation** and **query** nodes display:
28+
When you first open the **Documentation Explorer** pane, the **mutation** and `query` nodes display:
2329

2430
![Mutation and query nodes](../../static/images/docs-query.png)
2531

26-
* **query** is the name of the node.
27-
* **Query** is the type definition of the node.
32+
In this example `query` is the name of the node, and `Query` is the type definition of the node.
33+
34+
## Find the fields available for a given type definition
2835

29-
Click the **Query** type definition. The _Documentation Explorer_ panel displays the fields that the **query** node provides: **cost** and **viewer**.
36+
Click on the _type definition_ of a node to view the fields that it provides. The **Documentation Explorer** pane also displays descriptions of the nodes.
37+
38+
Click the Query type definition. The **Documentation Explorer** panel displays the fields that the `query` node provides. In this example, the fields are `cost` and `viewer`.
3039

3140
![Cost and viewer fields](../../static/images/docs-viewer.png)
3241

33-
Click on the type definition of **viewer** to list the fields of the **viewer** node. The **viewer** node fields include nodes that allow you to query **accounts** or **zones** data:
42+
## Find the arguments associated with a field
43+
44+
Click on the type definition of the `viewer` field to list its sub-fields. The `viewer` field provides sub-fields that allow you to query `accounts` or `zones` data:
3445

3546
![viewer fields](../../static/images/docs-zone-filter.png)
3647

37-
The **accounts** and **zones** nodes take arguments to specify what data set to query.
38-
For the **zones** node you can provide a **filter** of **ZoneFilter_InputObject** type. To view the fields to specify in the filter, click **ZoneFilter_InputObject**.
48+
The `accounts` and `zones` fields take arguments to specify what data set to query.
49+
50+
For the `zones` node you can provide a filter of ZoneFilter_InputObject type. To view the fields to specify in the filter, click **ZoneFilter_InputObject**.
51+
52+
To limit the amount of search results that the query returns, click the **limit** argument.
3953

40-
To limit the amount of search results that the query returns, click **limit**.
54+
## Find the search nodes available for a zone
4155

42-
To view a list of the fields within a zone, click on the **zones** type definition after the colon in the **zones** field:
56+
To view a list of the search nodes available for a zone, click on the `zones` type definition after the colon (`:`) in the `zones` field:
4357

4458
![Zones type definition](../../static/images/docs-zone.png)
4559

46-
A list of _search nodes_ appears, with a brief description of their behavior and a list of valid arguments.
47-
Arguments that end with an exclamation mark ("!") are required.
60+
A list of **search nodes** appears, with a brief description of their behavior and a list of valid arguments. Arguments that end with an exclamation mark (`!`) are required.
4861

4962
![Search nodes](../../static/images/docs-fw-data-set.png)
5063

products/analytics/src/content/graphql-api/getting-started/querying-basics.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ query{
4040
}
4141
```
4242

43-
## Example Query
43+
### Example Query
4444

4545
The following query searches data from a zone for firewall events that occurred during a time interval. It sorts the results, limits the amount of results returned, and displays a set of fields for each firewall event.
4646

4747
```json
48+
---
49+
header: Query Firewall events for a specific time interval
50+
---
4851
query
4952
{
5053
viewer
@@ -80,6 +83,9 @@ query
8083
You can send the query with an API call or by clicking **Play** in the GraphiQL client. The format of the response is in JSON:
8184

8285
```json
86+
---
87+
header: Query response from firewallEventsAdaptive
88+
---
8389
{
8490
"data": {
8591
"viewer": {
@@ -109,11 +115,14 @@ You can send the query with an API call or by clicking **Play** in the GraphiQL
109115
}
110116
```
111117

112-
## Example Query showing two sets of data
118+
## Querying two data sets in a single API call
113119

114-
This example query shows a range of GraphQL functionality. Two data sets for the specified zone are queried simultaneously, filters and aggregations are applied, and a limit is set on the number of records returned (note that you must include the `limit` argument, which can be equal or up to 10,000).
120+
This example query employs a broad range of GraphQL functionality. The example queries two data sets for the specified zone simultaneously, applies filters and aggregations, and sets a limit on the number of records returned. (Note that you must include the `limit` argument, which can be equal or up to 10,000.)
115121

116-
```code
122+
```json
123+
---
124+
header: Query two data sets simultaneously
125+
---
117126
query {
118127
viewer {
119128
zones(filter: {zoneTag: "<your zone ID>"}) {
@@ -148,7 +157,11 @@ This is only an example. You must specify the <code>zoneTag</code> for your doma
148157

149158
</Aside>
150159

151-
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_ users 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.
160+
## Introspection
161+
162+
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.
163+
164+
_GraphiQL_ users 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.
152165

153166
## Helpful Resources
154167

0 commit comments

Comments
 (0)