Skip to content

Commit e9990ac

Browse files
authored
Merge pull request #306611 from v-albemi/graphql-resolve
Freshness Edit: Azure API
2 parents f03e94c + a8ff5a4 commit e9990ac

2 files changed

Lines changed: 33 additions & 30 deletions

File tree

articles/api-management/graphql-schema-resolve-api.md

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
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
33
description: Add a synthetic GraphQL API by importing a GraphQL schema to API Management and configuring field resolvers that use HTTP-based data sources.
44
ms.service: azure-api-management
55
author: dlepow
66
ms.author: danlep
77
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.
910
---
1011

1112
# Add a synthetic GraphQL API and set up field resolvers
@@ -18,9 +19,9 @@ ms.date: 05/31/2023
1819

1920
In this article, you'll:
2021
> [!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.
2425
2526
If you want to expose an existing GraphQL endpoint as an API, see [Import a GraphQL API](graphql-api.md).
2627

@@ -35,39 +36,39 @@ If you want to expose an existing GraphQL endpoint as an API, see [Import a Grap
3536

3637
## Add a GraphQL schema
3738

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.
4041

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.":::
4243

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.
4445

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":::
4647

47-
| Field | Description |
48+
| Value | Description |
4849
|----------------|-------|
4950
| **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. |
5152
| **GraphQL type** | Select **Synthetic GraphQL** to import from a GraphQL schema file. |
5253
| **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. |
5354
| **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. |
5859
| **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. |
6061

6162

6263
1. Select **Create**.
6364

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.
6566

66-
## Configure resolver
67+
## Configure a resolver
6768

68-
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+
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).
6970

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.
7172

7273
```
7374
type Query {
@@ -80,19 +81,20 @@ type User {
8081
}
8182
```
8283

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**.
8789

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":::
8991

90-
1. On the **Create Resolver** page:
92+
1. In the **Create resolver** pane:
9193

9294
1. Update the **Name** property if you want to, optionally enter a **Description**, and confirm or update the **Type** and **Field** selections.
9395
1. In **Data source**, select **HTTP API**.
9496

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.
9698

9799

98100
```xml
@@ -104,9 +106,10 @@ type User {
104106
</http-data-source>
105107
```
106108

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+
108111
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.
110113

111114
> [!TIP]
112115
> 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.
44.5 KB
Loading

0 commit comments

Comments
 (0)