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: umbraco-heartcore/api-documentation/graphql/README.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,39 @@ query {
57
57
}
58
58
```
59
59
60
+
## Persisted queries
61
+
62
+
The GraphQL API supports [persisted queries](../graphql/persisted-queries.md), 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 support 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
+
60
93
## [Schema Generation](schema-generation.md)
61
94
62
95
Information on how the GraphQL schema is generated, reserved names and built-in custom types.
description: Documentation for Persisted queries in Umbraco Heartcore
3
+
---
4
+
5
+
# Persisted queries
6
+
7
+
Persisted queries allow you to store GraphQL queries on the server. This enables clients to execute them by referencing an alias rather than sending the full query each time. this approach streamlines client-server communication and enhances security.
8
+
9
+
## Why use persisted queries?
10
+
11
+
* Reducing the payload size
12
+
13
+
* You minimize the data transmitted over the network by sending only the alias and necessary variables. This reduction in payload size leads to faster request times and is particularly beneficial for mobile applications or environments with limited bandwidth.
14
+
15
+
* Enhanced Security
16
+
17
+
* Persisted queries provide improved security by ensuring that only predefined, server-stored GraphQL queries can be executed, preventing clients from running arbitrary or malicious queries.
18
+
19
+
To fully benefit from this, the content delivery API must be set to private, and GraphQL must be configured only to allow persisted queries. Without these settings in place, the security advantages of using persisted queries are not realized.
20
+
21
+
## Enable Persisted queries only
22
+
23
+
In order to fully benefit from the security enhancement that comes with persisted queries you need to enable the ` Only allow GraphQL persisted queries` setting. This can be done from the headless options section within the backoffice
24
+
25
+
Please be aware this will also disable the execution of queries in the playground.
Copy file name to clipboardExpand all lines: umbraco-heartcore/getting-started/graphql-playground.md
+53-16Lines changed: 53 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,31 +17,28 @@ The Playground comes with basic features such as real-time error highlighting, s
17
17
1. Log into the project backoffice
18
18
2. Navigate to the Settings dashboard
19
19
3. Find the Headless tree near the bottom of the navigation list
20
-
4. Click on GraphQL Playground
20
+
4. Click on GraphQL
21
21
22
-

22
+

23
23
24
24
From there, you can start querying as soon as your content is published.
25
25
26
26
## Features
27
27
28
-
### Documentation
28
+
### Documentation & Schema
29
29
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
31
31
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 panel that grants you a quick overview of how content is structured using the Document Types in your solution.
33
33
34
-

34
+
It also gives an idea of how to access specific properties on each Document Type, nested properties, and properties from compositions.
35
35
36
-
The documentation will be automatically updated as you add new Document Types to match the schema you have on your project.
36
+
At the same time, it also explains relationships between specific objects and properties in your solution.
37
37
38
-
## Schema
38
+
This will be updated automatically as you change the project's schema meaning Document Types, Data Types, Document Type Compositions, and Document Type Elements.
39
39
40
-
The Schema tab also can be found on the right side of the GraphQL Playground. It is located below the "Docs" tab.
41
40
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
-

41
+

45
42
46
43
## Running GraphQL queries
47
44
@@ -65,26 +62,66 @@ The Heartcore GraphQL endpoint only supports queries - other operation types, th
65
62
66
63
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.
67
64
68
-

65
+

69
66
70
67
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.
71
68
72
69
## Sending HTTP headers
73
70
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.
71
+
GraphQL Playground supports requests with HTTP headers if 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, the alias of your Heartcore project. It is possible to add multiple headers.
75
72
76
73
## Query variables
77
74
78
75
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.
79
76
80
-

77
+

81
78
82
79
## History
83
80
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.
81
+
If you happen to make an amazing query and afterward erase it by accident, you can re-use it by finding it in the History.
82
+
83
+
The History pane can be opened by clicking the history button in the toolbar to the left.
84
+
85
+

85
86
86
87
## Prettify
87
88
88
89
The Playground gives you an option to "prettify" your query with a click of a button, which makes it easier for humans to read.
89
90
90
91

92
+
93
+
## Persisted Queries
94
+
95
+
The Graphql playground supports [persisted Graphql queries](../api-documentation/graphql/persisted-queries.md).
96
+
To access Persisted queries you have to go to the [GraphQL Playground](#accessing-graphql-playground) and click the persisted queries tab
0 commit comments