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
An experimental implementation of [GraphQL](https://graphql.org) for Umbraco using [GraphQL for .NET](https://github.com/graphql-dotnet/graphql-dotnet).
@@ -12,14 +13,22 @@ An Owin middleware exposes Umbraco Published Content as a GraphQL endpoint.
12
13
13
14
GraphQL types are dynamically generated for all Umbraco document types (content and media), with all the properties as fields. They all implement an interface `PublishedContent` which implements the generic Umbraco properties as fields.
14
15
15
-
If a document type is alloweded at root, a field on the query is generated with the same name as the document type alias.
16
+
## Installation
16
17
17
-
There are also two generic fields `content(id: ID!)` and `contentAtRoot` which can be used to query by `id` or getting all root content.
18
+
The preferred way to install GraphQL for Umbraco is through NuGet
18
19
19
-
## Getting started
20
-
Clone the repository and run the Website (F5 in Visual Studio), install Umbraco with the starter kit and start exploring the API using GraphiQL by opening `/umbraco/graphiql`.
20
+
### Option 1: NuGet
21
+
22
+
GraphQL for Umbraco is available as a NuGet [package](https://www.nuget.org/packages/Our.Umbraco.GraphQL).
23
+
24
+
To install run the following command in the [Package Manager Console](https://docs.nuget.org/docs/start-here/using-the-package-manager-console)
21
25
22
-
There's also a [download](https://drive.google.com/file/d/1L67kZV7u6tXy45zknLih421Rlbrx3fh3/view) which contains a prebuilt website with some sample data based on the starter kit. Login `[email protected]`/`1234567890`. It's based on the Umbraco starter kit, where `People`, `Products` and `Blog` has been moved to the root of the tree.
26
+
```powershell
27
+
PM> Install-Package Our.Umbraco.GraphQL
28
+
```
29
+
30
+
### Option 2: From source
31
+
Clone the repository and run the Website (F5 in Visual Studio), install Umbraco with the starter kit and start exploring the API using GraphiQL by opening `/umbraco/graphiql`.
23
32
24
33
### Urls
25
34
| Url | Description |
@@ -29,87 +38,123 @@ There's also a [download](https://drive.google.com/file/d/1L67kZV7u6tXy45zknLih4
29
38
| /umbraco/graphql/schema | The generated schema |
30
39
31
40
### Querying
32
-
Query examples based on the download above
33
-
41
+
Query examples based on The Starter Kit
34
42
```graphql
35
43
{
36
-
people {
37
-
pageTitle
38
-
children {
39
-
items {
40
-
...onPerson {
41
-
name
42
-
department
43
-
photo {
44
-
url
44
+
content {
45
+
byType {
46
+
People(id: "1116") {
47
+
pageTitle
48
+
_contentData {
49
+
children {
50
+
items {
51
+
...onPerson {
52
+
_contentData {
53
+
name
54
+
}
55
+
department
56
+
photo {
57
+
_contentData {
58
+
url
59
+
}
60
+
}
61
+
}
62
+
}
45
63
}
46
64
}
47
65
}
48
66
}
49
67
}
50
68
}
69
+
51
70
```
52
71
53
72
We can also do some simple filtering and sorting, ([Inspired by the Grahpcool filtering](https://www.graph.cool/docs/reference/graphql-api/query-api-nia9nushae#query-arguments)) like geting all children of people that starts with the letter `J`
0 commit comments