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
docs: move HOW-TO to graphql-playground.mdx; add optional Star Wars step
- Restore tyk-developer-portal/graphql-playground.mdx with full HOW-TO
content (replaces tutorial; retains old URL, no redirect needed)
- Add step 1 (Optional): create Star Wars test API + download schema
- Delete portal/api-products/graphql-products.mdx
- Update docs.json: swap nav entry to tyk-developer-portal/graphql-playground
under Publishing APIs; remove redirect
Copy file name to clipboardExpand all lines: tyk-developer-portal/graphql-playground.mdx
+24-27Lines changed: 24 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Set Up GraphQL Documentation for API Products"
3
3
description: "How to add GraphQL SDL documentation and enable the interactive Playground for an API Product in the Tyk Developer Portal."
4
-
sidebarTitle: "GraphQL Products"
4
+
sidebarTitle: "GraphQL Playground"
5
5
keywords: "Developer Portal, GraphQL, SDL, GraphQL Playground, Universal Data Graph, UDG, API Product documentation, GraphQL schema"
6
6
---
7
7
@@ -28,60 +28,57 @@ You can add a GraphQL Schema Definition Language (SDL) file to an API Product to
28
28
29
29
## Add GraphQL Documentation to an API Product
30
30
31
-
<Tip>
32
-
If you want to follow along with a ready-made example, use the **Star Wars GQL API** available from the Tyk Dashboard.
31
+
1.**(Optional) Create a test GraphQL API**
33
32
34
-
Navigate to **APIs > Add New API**, click **Try example**, select **Star Wars GQL API**, and click **Use Example**.
33
+
If you don't have an existing GraphQL API, use the built-in Star Wars example from the Tyk Dashboard:
34
+
- Navigate to **APIs > Add New API**, click **Try example**, select **Star Wars GQL API**, and click **Use Example**
35
+
- Copy the **Key ID** from the confirmation pop-up and save it — you will use this as the auth header when testing in the Playground
36
+
- Go to the **Schema** tab of the newly created API and download the schema file — you will upload this as the SDL file in step 5
35
37
36
-
The Star Wars API uses [Auth Token](/api-management/authentication/bearer-token) authentication, copy the Key ID from the confirmation pop-up and use it as the `Authorization: Bearer <Key ID>` header when testing in the Playground.
37
-
</Tip>
38
+
<imgsrc="/img/graphql-api-star-wars-schema.png"alt="GraphQL API Schema Tab" />
38
39
39
-
1. Navigate to **Developer Portal > API Products** and open the product you want to update, or [create a new API Product](/portal/api-products#creating-a-new-api-product).
40
+
2. Navigate to **Developer Portal > API Products** and open the product you want to update, or [create a new API Product](/portal/api-products#creating-a-new-api-product).
40
41
41
-
2. On the **APIs** tab, select your GraphQL API:
42
+
3. On the **APIs** tab, select your GraphQL API:
42
43
-**Choose a provider**: select the Tyk Dashboard provider
43
44
-**Choose authentication method**: match the authentication configured on your GraphQL API
44
45
-**Select APIs**: check your GraphQL API from the list
45
46
46
-
3. Go to the **Documentation** tab and click **Add API specification**.
47
+
4. Go to the **Documentation** tab and click **Add API specification**.
47
48
48
-
4. Set the specification type to **GraphQL SDL**, then upload your schema file.
49
+
5. Set the specification type to **GraphQL SDL**, then upload your schema file.
49
50
50
51
Accepted formats: `.graphql`, `.graphqls`, `.gql`, `.json`. The maximum file size is set by `PORTAL_MAX_UPLOAD_SIZE` (up to 32 MB).
51
52
52
53
<imgsrc="/img/graphql-docs-tab-playground-setup.png"alt="Documentation tab with GraphQL SDL upload and Server URL field" />
53
54
54
-
5. Set the **GraphQL Server URL** to the endpoint of your GraphQL API on the Gateway (for example, `http://gateway.example.com/my-graphql-api/`).
55
+
6. Set the **GraphQL Server URL** to the endpoint of your GraphQL API on the Gateway (for example, `http://gateway.example.com/my-graphql-api/`).
55
56
56
57
From v1.16.0, this field is [auto-populated](#graphql-server-url-and-baseline-url) from your Provider's Baseline URL and the API's listen path. You can edit the value at any time.
57
58
58
59
<Note>
59
60
The URL must end with a trailing slash. A missing trailing slash causes a 404 error in the Playground.
60
61
</Note>
61
62
62
-
6. Click **Save Changes**.
63
+
7. Click **Save Changes**.
63
64
64
-
7. Open your **Live Portal**, go to **Product Catalogues**, locate the product, and click **Docs** to see the GraphQL Playground.
65
+
8. Open your **Live Portal**, go to **Product Catalogues**, locate the product, and click **Docs**.
65
66
66
67
<imgsrc="/img/graphql-docs-live-portal.png"alt="GraphQL API Docs Live Portal" />
67
68
68
-
8. You should now see the **GraphQL Playground**, ready for interactive query testing.
69
+
9. You should now see the **GraphQL Playground**, ready for interactive query testing.
69
70
70
-
<Note>
71
-
72
-
To test authenticated APIs, ensure you set the required authentication headers in the Playground according to your API's authentication settings.
73
-
74
-
For example, for the `Star Wars GQL API`, add the `Authorization` header with the value `Bearer <Key ID>` where `<Key ID>` is the token you saved earlier.
75
-
76
-
```json
77
-
{
78
-
"Authorization": "Bearer YOUR_KEY_ID"
79
-
}
80
-
```
81
-
</Note>
71
+
<Note>
72
+
To test authenticated APIs, set the required authentication headers in the Playground. For example, for the Star Wars GQL API, add the `Authorization` header with the value `Bearer <Key ID>` where `<Key ID>` is the token you saved in step 1.
82
73
74
+
```json
75
+
{
76
+
"Authorization": "Bearer YOUR_KEY_ID"
77
+
}
78
+
```
79
+
</Note>
83
80
84
-
<imgsrc="/img/graphql-playground-portal.png"alt="GraphQL API Playground" />
81
+
<imgsrc="/img/graphql-playground-portal.png"alt="GraphQL API Playground" />
0 commit comments