You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: products/analytics/src/content/graphql-api/getting-started/explore-graphql-schema.md
+27-14Lines changed: 27 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,48 +3,61 @@ title: Explore the GraphQL schema
3
3
order: 40
4
4
---
5
5
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.
7
11
8
12
You can explore the schema of the Coudflare GraphQL endpoint in the the GraphQL client. The examples below use the GraphiQL client.
9
13
10
14
Before you begin, configure the API endpoint and HTTP headers in the GraphQL client.
11
15
12
-
Click **Docs** to open the _Documentation Explorer_ pane.
16
+
## Use the Documentation Explorer
17
+
18
+
Click **Docs** to open the **Documentation Explorer** pane.
13
19
14
20
A list of available nodes displays. The nodes in the list follow this syntax:
15
21
16
22
```
17
23
node-name: node-type-definition
18
24
```
19
25
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
21
27
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:
23
29
24
30

25
31
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
28
35
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`.
30
39
31
40

32
41
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:
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.
39
53
40
-
To limit the amount of search results that the query returns, click **limit**.
54
+
## Find the search nodes available for a zone
41
55
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:
43
57
44
58

45
59
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.
Copy file name to clipboardExpand all lines: products/analytics/src/content/graphql-api/getting-started/querying-basics.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,11 +40,14 @@ query{
40
40
}
41
41
```
42
42
43
-
## Example Query
43
+
###Example Query
44
44
45
45
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.
46
46
47
47
```json
48
+
---
49
+
header: Query Firewall events for a specific time interval
50
+
---
48
51
query
49
52
{
50
53
viewer
@@ -80,6 +83,9 @@ query
80
83
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:
81
84
82
85
```json
86
+
---
87
+
header: Query response from firewallEventsAdaptive
88
+
---
83
89
{
84
90
"data": {
85
91
"viewer": {
@@ -109,11 +115,14 @@ You can send the query with an API call or by clicking **Play** in the GraphiQL
109
115
}
110
116
```
111
117
112
-
## Example Query showing two sets of data
118
+
## Querying two data sets in a single API call
113
119
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.)
115
121
116
-
```code
122
+
```json
123
+
---
124
+
header: Query two data sets simultaneously
125
+
---
117
126
query {
118
127
viewer {
119
128
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
148
157
149
158
</Aside>
150
159
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.
0 commit comments