Skip to content

Commit 8b7c522

Browse files
committed
Update docs for Heartcore Persisted queries
1 parent 641782e commit 8b7c522

File tree

12 files changed

+87
-17
lines changed

12 files changed

+87
-17
lines changed

umbraco-heartcore/api-documentation/graphql/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,39 @@ query {
5757
}
5858
```
5959

60+
## Persisted queries
61+
62+
The GraphQL API supports persisted queries, running a persisted query can be done using the following payload in the graphql request
63+
64+
```json
65+
{
66+
"extensions": {
67+
"persistedQuery": {
68+
"alias": "{Alias}"
69+
}
70+
}
71+
}
72+
```
73+
The persisted queries also supports variables
74+
75+
```json
76+
{
77+
"extensions": {
78+
"persistedQuery": {
79+
"alias": "{Alias}"
80+
}
81+
},
82+
"variables": {
83+
"url": "/"
84+
}
85+
}
86+
```
87+
88+
{% hint style="info" %}
89+
Persisted queries can be created within the backoffice in the [GraphQL Playground](../../getting-started/graphql-playground.md#persisted-queries)
90+
{% endhint %}
91+
92+
6093
## [Schema Generation](schema-generation.md)
6194

6295
Information on how the GraphQL schema is generated, reserved names and built-in custom types.

umbraco-heartcore/getting-started/graphql-playground.md

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,27 @@ The Playground comes with basic features such as real-time error highlighting, s
1717
1. Log into the project backoffice
1818
2. Navigate to the Settings dashboard
1919
3. Find the Headless tree near the bottom of the navigation list
20-
4. Click on GraphQL Playground
20+
4. Click on GraphQL
2121

22-
![Where to find GraphQL Playground](images/where-to-find-graphql-playground.png)
22+
![Where to find GraphQL](images/where-to-find-graphql-playground.png)
2323

2424
From there, you can start querying as soon as your content is published.
2525

2626
## Features
2727

28-
### Documentation
28+
### Documentation & Schema
2929

30-
The GraphQL Playground's built-in documentation can be found on the right side, under the "Docs" tab.
30+
The GraphQL Playground's build-in documentation and schema browser can be found on the left toolbar
3131

32-
The documentation tab grants a quick overview of how content is structured using the Document Types in your solution. It also gives an idea of how to access specific properties on each of the Document Types as well as nested properties and properties from Compositions.
32+
This button will open a pane that grants you a quick overview of how content is structured using the Document Types in your solution.
3333

34-
![Documentation Tab in the Playground](images/docs-helper.png)
34+
It also gives an idea of how to access specific properties on each of the Document Types as well as nested properties and properties from Compositions.
3535

36-
The documentation will be automatically updated as you add new Document Types to match the schema you have on your project.
36+
While at the same time also explains relationships between specific object and properties in your solution.
3737

38-
## Schema
38+
This will be updated automatically as you make change to the projects schema meaning Document Types, Data Types, Document Type Compositions and Document Type Elements.
3939

40-
The Schema tab also can be found on the right side of the GraphQL Playground. It is located below the "Docs" tab.
41-
42-
The Schema menu explains the relationships between specific objects and properties in your solution, and will be updated automatically as you make changes to the project's schema meaning Document Types, Data Types, Document Type Compositions and Document Type Elements.
43-
44-
![Schema Tab in the Playground](images/schema-helper.png)
40+
![Documentation and schema pane in the Playground](images/schema-helper.png)
4541

4642
## Running GraphQL queries
4743

@@ -65,26 +61,67 @@ The Heartcore GraphQL endpoint only supports queries - other operation types, th
6561

6662
After that, press the "Play" button sitting in the center of the Playground. If the query is constructed correctly, the results will be loaded into the right section.
6763

68-
![Schema Tab in the Playground](images/sample-query.png)
64+
![Sample query in the Playground](images/sample-query.png)
6965

7066
When you are satisfied with the result, you can copy the client URL (CURL) by clicking the `COPY CURL` button located in the top part of the Playground, next to the address bar.
7167

7268
## Sending HTTP headers
7369

74-
GraphQL Playground supports requests made with HTTP headers - in case for example an authorization token is needed. The `HTTP HEADERS` section can be accessed from the bottom-left corner of the Playground window. By default, it contains the `umb-project-alias` header, which is the alias of your Heartcore project. It is possible to add multiple headers.
70+
GraphQL Playground supports requests made with HTTP headers - in case for example an authorization token is needed. The `HTTP HEADERS` section can be accessed from the bottom-right corner of the Playground window. By default, it contains the `umb-project-alias` header, which is the alias of your Heartcore project. It is possible to add multiple headers.
7571

7672
## Query variables
7773

7874
It is also possible to define variables for queries - such variables's values can be changed in the bottom-left corner of the Playground window, next to the `HTTP HEADERS` section.
7975

80-
![Schema Tab in the Playground](images/query-variables.png)
76+
![Sample query with variables in the Playground ](images/query-variables.png)
8177

8278
## History
8379

84-
If you happened to make an amazing query and afterwards erased it by accident, you would be able to re-use it by finding it in the History. The History menu can be found in the top part of the Playground, above the query input section.
80+
If you happened to make an amazing query and afterwards erased it by accident, you would be able to re-use it by finding it in the History.
81+
82+
The History pane can be opened by clicking the history button in the toolbar to the left.
83+
84+
![Shows where the history button is](images/query-history.png)
8585

8686
## Prettify
8787

8888
The Playground gives you an option to "prettify" your query with a click of a button, which makes it easier for humans to read.
8989

9090
![Schema Tab in the Playground](images/prettify.png)
91+
92+
## Persisted Queries
93+
94+
The Graphql playground supports persisted graphql queries.
95+
To access Persisted queries you have to go to the [GraphQL Playground](#accessing-graphql-playground) and click the persisted queries tab
96+
97+
![Persisted queries tab](images/persisted-queries-tab.png)
98+
99+
### Create a new persisted query
100+
101+
1. Click the `Create Persisted Query` button
102+
2. Enter a name for the query in the new query editor that appears
103+
3. Write your query in the editor
104+
4. Click the `Save` button
105+
106+
![Create persisted query](images/create-persisted-query.png)
107+
108+
### Update a persisted query
109+
110+
1. Find the query you want to update in the persisted queries list
111+
2. Click on the name of the query
112+
3. An editor will appear with the query
113+
4. Make your changes and click the `Save` button
114+
115+
![Update persisted query](images/update-persisted-query.png)
116+
117+
### Delete a persisted query
118+
119+
1. Find the query you want to delete in the persisted queries list
120+
2. Click on the name of the query
121+
3. An editor will appear with the query
122+
4. Click the action menu in the top right corner of the editor
123+
5. Click the `Delete` button
124+
6. Confirm the deletion
125+
126+
![Delete persisted query](images/delete-persisted-query.png)
127+
88.6 KB
Loading
74 KB
Loading
60.1 KB
Loading
11.7 KB
Loading
89.2 KB
Loading
26.4 KB
Loading
-19.8 KB
Loading
931 Bytes
Loading

0 commit comments

Comments
 (0)