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: articles/api-management/graphql-schema-resolve-api.md
+33-30Lines changed: 33 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,12 @@
1
1
---
2
-
title: Add a synthetic GraphQL API to Azure API Management | Microsoft Docs
2
+
title: Add a Synthetic GraphQL API to Azure API Management | Microsoft Docs
3
3
description: Add a synthetic GraphQL API by importing a GraphQL schema to API Management and configuring field resolvers that use HTTP-based data sources.
4
4
ms.service: azure-api-management
5
5
author: dlepow
6
6
ms.author: danlep
7
7
ms.topic: how-to
8
-
ms.date: 05/31/2023
8
+
ms.date: 10/08/2025
9
+
# Customer intent: As an API admin, I want to add a synthetic GraphQL API to API Management so that I can expose it as an API.
9
10
---
10
11
11
12
# Add a synthetic GraphQL API and set up field resolvers
@@ -18,9 +19,9 @@ ms.date: 05/31/2023
18
19
19
20
In this article, you'll:
20
21
> [!div class="checklist"]
21
-
> * Import a GraphQL schema to your API Management instance
22
-
> * Set up a resolver for a GraphQL query using an existing HTTP endpoint
23
-
> * Test your GraphQL API
22
+
> * Import a GraphQL schema to your Azure API Management instance.
23
+
> * Set up a resolver for a GraphQL query using an existing HTTP endpoint.
24
+
> * Test your GraphQL API.
24
25
25
26
If you want to expose an existing GraphQL endpoint as an API, see [Import a GraphQL API](graphql-api.md).
26
27
@@ -35,39 +36,39 @@ If you want to expose an existing GraphQL endpoint as an API, see [Import a Grap
35
36
36
37
## Add a GraphQL schema
37
38
38
-
1.From the side navigation menu, under the **APIs** section, select **APIs**.
39
-
1. Under **Define a new API**, select the **GraphQL**icon.
39
+
1.In the left pane, under **APIs**, select **APIs**.
40
+
1. Under **Define a new API**, select the **GraphQL**tile.
40
41
41
-
:::image type="content" source="media/graphql-api/import-graphql-api.png" alt-text="Screenshot of selecting GraphQL icon from list of APIs.":::
42
+
:::image type="content" source="media/graphql-api/import-graphql-api.png" alt-text="Screenshot of selecting the GraphQL tile.":::
42
43
43
-
1. In the dialog box, select **Full** and complete the required form fields.
44
+
1. In the dialog box, select **Full**, and then enter values in the required fields, as described in the following table.
44
45
45
-
:::image type="content" source="media/graphql-schema-resolve-api/create-from-graphql-schema.png" alt-text="Screenshot of fields for creating a GraphQL API.":::
46
+
:::image type="content" source="media/graphql-schema-resolve-api/create-from-graphql-schema.png" alt-text="Screenshot of the Create from GraphQL schema page." lightbox="media/graphql-schema-resolve-api/create-from-graphql-schema.png":::
46
47
47
-
|Field| Description |
48
+
|Value| Description |
48
49
|----------------|-------|
49
50
|**Display name**| The name by which your GraphQL API will be displayed. |
50
-
|**Name**|Raw name of the GraphQL API. Automatically populates as you type the display name. |
51
+
|**Name**|The raw name of the GraphQL API. Automatically populates as you type the display name. |
51
52
|**GraphQL type**| Select **Synthetic GraphQL** to import from a GraphQL schema file. |
52
53
|**Fallback GraphQL endpoint**| Optionally enter a URL with a GraphQL API endpoint name. API Management passes GraphQL queries to this endpoint when a custom resolver isn't set for a field. |
53
54
|**Description**| Add a description of your API. |
54
-
|**URL scheme**| Make a selection based on your GraphQL endpoint. Select one of the options that includes a WebSocket scheme (**WS** or **WSS**) if your GraphQL API includes the subscription type. Default selection: *HTTP(S)*. |
55
-
|**API URL suffix**| Add a URL suffix to identify this specific API in this API Management instance. It has to be unique in this API Management instance. |
56
-
|**Base URL**| Uneditable field displaying your API base URL |
57
-
|**Tags**|Associate your GraphQL API with new or existing tags. |
55
+
|**URL scheme**|Select a scheme based on your GraphQL endpoint. Select one of the options that includes a WebSocket scheme (**WS** or **WSS**) if your GraphQL API includes the subscription type. The default selection is **HTTP(S)**. |
56
+
|**API URL suffix**| Add a URL suffix to identify the specific API in the API Management instance. Must be unique in the API Management instance. |
57
+
|**Base URL**| Uneditable field displaying your API base URL.|
58
+
|**Tags**|Optionally associate your GraphQL API with new or existing tags. |
58
59
|**Products**| Associate your GraphQL API with a product to publish it. |
59
-
|**Version this API?**| Select to apply a versioning scheme to your GraphQL API. |
60
+
|**Version this API?**| Select the checkbox to apply a versioning scheme to your GraphQL API. |
60
61
61
62
62
63
1. Select **Create**.
63
64
64
-
1. After the API is created, browse or modify the schema on the **Design** tab.
65
+
1. After the API is created, review or modify the schema on the **Schema** tab.
65
66
66
-
## Configure resolver
67
+
## Configure a resolver
67
68
68
-
Configure a resolver to map a field in the schema to an existing HTTP endpoint. Highlevel steps are provided here. For details, see [Configure a GraphQL resolver](configure-graphql-resolver.md).
69
+
Configure a resolver to map a field in the schema to an existing HTTP endpoint. High-level steps are provided here. For details, see [Configure a GraphQL resolver](configure-graphql-resolver.md).
69
70
70
-
Suppose you imported the following basic GraphQL schema and wanted to set up a resolver for the *users* query.
71
+
Suppose you imported the following basic GraphQL schema and want to set up a resolver for the `users` query.
71
72
72
73
```
73
74
type Query {
@@ -80,19 +81,20 @@ type User {
80
81
}
81
82
```
82
83
83
-
1. From the side navigation menu, under the **APIs** section, select **APIs** > your GraphQL API.
84
-
1. On the **Schema** tab, review the schema for a field in an object type where you want to configure a resolver.
85
-
1. Select a field, and then in the left margin, hover the pointer.
86
-
1. Select **+ Add Resolver**
84
+
1. In the left pane, under **APIs**, select **APIs**.
85
+
1. Select your GraphQL API.
86
+
1. On the **Schema** tab, review the schema for a field in an object type in which you want to configure a resolver.
87
+
1. Select a field, and then hover the pointer in the left margin.
88
+
1. Select **Add resolver**.
87
89
88
-
:::image type="content" source="media/graphql-schema-resolve-api/add-resolver.png" alt-text="Screenshot of adding a GraphQL resolver in the portal.":::
90
+
:::image type="content" source="media/graphql-schema-resolve-api/add-resolver.png" alt-text="Screenshot of adding a GraphQL resolver in the portal." lightbox="media/graphql-schema-resolve-api/add-resolver.png":::
89
91
90
-
1.On the **Create Resolver**page:
92
+
1.In the **Create resolver**pane:
91
93
92
94
1. Update the **Name** property if you want to, optionally enter a **Description**, and confirm or update the **Type** and **Field** selections.
93
95
1. In **Data source**, select **HTTP API**.
94
96
95
-
1. In the **Resolver policy** editor, update the `<http-data-source>` element with child elements for your scenario. For example, the following resolver retrieves the *users* field by making a `GET` call to an existing HTTP data source.
97
+
1. In the **Resolver policy** editor, update the `<http-data-source>` element with child elements for your scenario. For example, the following resolver retrieves the `users` field by making a `GET` call to an existing HTTP data source.
96
98
97
99
98
100
```xml
@@ -104,9 +106,10 @@ type User {
104
106
</http-data-source>
105
107
```
106
108
107
-
:::image type="content" source="media/graphql-schema-resolve-api/configure-resolver-policy.png" alt-text="Screenshot of configuring resolver policy in the portal.":::
109
+
:::image type="content" source="media/graphql-schema-resolve-api/configure-resolver-policy.png" alt-text="Screenshot of configuring resolver a policy in the portal." lightbox="media/graphql-schema-resolve-api/configure-resolver-policy.png":::
110
+
108
111
1. Select **Create**.
109
-
1. To resolve data for another field in the schema, repeat the preceding steps to create a resolver.
112
+
1. To resolve data for another field in the schema, repeat the preceding steps to create another resolver.
110
113
111
114
> [!TIP]
112
115
> As you edit a resolver policy, select **Run Test** to check the output from the data source, which you can validate against the schema. If errors occur, the response includes troubleshooting information.
0 commit comments