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
[Style Guide] Merge GraphQL API Explorer info from README into Style Guide (#25116)
* graphql merge content
* Small tweaks to customer variable example
* Apply suggestions from code review
Co-authored-by: Pedro Sousa <[email protected]>
---------
Co-authored-by: Pedro Sousa <[email protected]>
Copy file name to clipboardExpand all lines: src/content/docs/style-guide/components/code.mdx
+37-21Lines changed: 37 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,13 +113,15 @@ export default {
113
113
```
114
114
````
115
115
116
-
## GraphQL API explorer
116
+
## GraphQL API Explorer
117
117
118
-
If you add the `graphql-api-explorer` option to the opening code fence for a `graphql` code block, it will
119
-
add a "Run in GraphQL API Explorer" link that will take the user to the [GraphQL API explorer](https://graphql.cloudflare.com/explorer).
118
+
Add `graphql-api-explorer` to the opening code fence to create a `graphql` code block with a **Run in GraphQL API Explorer** button that leads to [GraphQL API Explorer](https://graphql.cloudflare.com/explorer).
120
119
121
-
### Live demo
120
+
:::note
121
+
This button only works if the person selecting it is logged in or has an API token saved.
In the GraphQL API Explorer, the **Variables** section is automatically filled based on the names and types of the variables defined in your query:
147
+
- Variables that include `start` and are of type `Time` are set to six hours before the current time
148
+
- Variables that include `end` and are of type `Time` are set to the current time
149
+
- Variables that include `start` and are of type `Date` are set to 24 hours before the current date
150
+
- Variables that include `end` and are of type `Date` are set to the current date
151
+
- Variables that include `zoneTag` and are of type `string` are set to "ZONE_ID"
152
+
- Variables that include `accountTag` and are of type `string` are set to "ACCOUNT_ID"
153
+
- Variables that include `id` and are of type `string` are set to "REPLACE_WITH_ID"
154
+
- Variables that include `limit` and are of type `int` are set to 100
155
+
- Any other variable with a type of `string` is set to "REPLACE_WITH_STRING"
156
+
157
+
You can also add custom variables by setting their values as a JSON string in the `graphql-api-explorer` metadata. The custom variables will be merged with the automatically populated variables.
158
+
159
+
In the following example, the custom value is `custom-variable`:
0 commit comments