Skip to content

Commit 40d4412

Browse files
authored
Merge pull request #197436 from dlepow/gqlfed
[APIM] GraphQL federation preview
2 parents 6296f5d + b463cc6 commit 40d4412

19 files changed

+532
-207
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,6 +2928,11 @@
29282928
"redirect_url": "/azure/api-management/api-management-howto-add-products",
29292929
"redirect_document_id": false
29302930
},
2931+
{
2932+
"source_path_from_root": "/articles/api-management/graphql-validation-policies.md",
2933+
"redirect_url": "/azure/api-management/graphql-policies",
2934+
"redirect_document_id": false
2935+
},
29312936
{
29322937
"source_path_from_root": "/articles/api-management/api-management-policy-reference.md",
29332938
"redirect_url": "/azure/api-management/api-management-policies",

articles/api-management/TOC.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@
184184
href: websocket-api.md
185185
- name: Import a GraphQL API
186186
href: graphql-api.md
187+
- name: Import and resolve GraphQL schema
188+
href: graphql-schema-resolve-api.md
187189
- name: Import an App Service web API
188190
href: import-app-service-as-api.md
189191
- name: Import a Container App web API
@@ -365,8 +367,8 @@
365367
href: api-management-cross-domain-policies.md
366368
- name: Distributed Application Runtime (Dapr) integration policies
367369
href: api-management-dapr-policies.md
368-
- name: GraphQL validation policies
369-
href: graphql-validation-policies.md
370+
- name: GraphQL API policies
371+
href: graphql-policies.md
370372
- name: Transformation policies
371373
href: api-management-transformation-policies.md
372374
- name: Validation policies

articles/api-management/api-management-policies.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ More information about policies:
6767
- [Send message to Pub/Sub topic](api-management-dapr-policies.md#pubsub) - uses Dapr runtime to publish a message to a Publish/Subscribe topic.
6868
- [Trigger output binding](api-management-dapr-policies.md#bind) - uses Dapr runtime to invoke an external system via output binding.
6969

70-
## [GraphQL validation policy](graphql-validation-policies.md)
71-
- [Validate GraphQL request](graphql-validation-policies.md#validate-graphql-request) - Validates and authorizes a request to a GraphQL API.
70+
## [GraphQL API policies](graphql-policies.md)
71+
- [Validate GraphQL request](graphql-policies.md#validate-graphql-request) - Validates and authorizes a request to a GraphQL API.
72+
- [Set GraphQL resolver](graphql-policies.md#set-graphql-resolver) - Retrieves or sets data for a GraphQL field in an object type specified in a GraphQL schema.
7273

7374
## [Transformation policies](api-management-transformation-policies.md)
7475
- [Convert JSON to XML](api-management-transformation-policies.md#ConvertJSONtoXML) - Converts request or response body from JSON to XML.

articles/api-management/graphql-api.md

Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
---
2-
title: Import a GraphQL API using the Azure portal | Microsoft Docs
2+
title: Import a GraphQL API to Azure API Management using the portal | Microsoft Docs
33
titleSuffix:
4-
description: Learn how API Management supports GraphQL, add a GraphQL API, and GraphQL limitations.
4+
description: Learn how to add an existing GraphQL service as an API in Azure API Management. Manage the API and enable queries to pass through to the GraphQL endpoint.
55
ms.service: api-management
66
author: dlepow
77
ms.author: danlep
88
ms.topic: how-to
9-
ms.date: 10/21/2021
10-
ms.custom: ignite-fall-2021
9+
ms.date: 05/17/2022
10+
ms.custom: event-tier1-build-2022
1111
---
1212

13-
# Import a GraphQL API (preview)
13+
# Import a GraphQL API
1414

15-
GraphQL is an open-source, industry-standard query language for APIs. Unlike endpoint-based (or REST-style) APIs designed around actions over resources, GraphQL APIs support a broader set of use cases and focus on data types, schemas, and queries.
16-
17-
API Management tackles the security, authentication, and authorization challenges that come with publishing GraphQL APIs. Using API Management to expose your GraphQL APIs, you can:
18-
* Add a GraphQL service as APIs via Azure portal.
19-
* Secure GraphQL APIs by applying both existing access control policies and a [new policy](graphql-validation-policies.md) to secure and protect against GraphQL-specific attacks.
20-
* Explore the schema and run test queries against the GraphQL APIs in the Azure and developer portals.
21-
22-
[!INCLUDE [preview-callout-graphql.md](./includes/preview/preview-callout-graphql.md)]
15+
[!INCLUDE [api-management-graphql-intro.md](../../includes/api-management-graphql-intro.md)]
2316

2417
In this article, you'll:
2518
> [!div class="checklist"]
@@ -28,71 +21,47 @@ In this article, you'll:
2821
> * Test your GraphQL API.
2922
> * Learn the limitations of your GraphQL API in API Management.
3023
24+
If you want to import a GraphQL schema and set up field resolvers using REST or SOAP API endpoints, see [Import a GraphQL schema and set up field resolvers](graphql-schema-resolve-api.md).
25+
3126
## Prerequisites
3227

3328
- An existing API Management instance. [Create one if you haven't already](get-started-create-service-instance.md).
3429
- A GraphQL API.
3530

31+
[!INCLUDE [api-management-navigate-to-instance.md](../../includes/api-management-navigate-to-instance.md)]
32+
3633
## Add a GraphQL API
3734

3835
1. Navigate to your API Management instance.
3936
1. From the side navigation menu, under the **APIs** section, select **APIs**.
4037
1. Under **Define a new API**, select the **GraphQL** icon.
4138

42-
:::image type="content" source="media/graphql-api/import-graphql-api.png" alt-text="Selecting GraphQL icon from list of APIs":::
39+
:::image type="content" source="media/graphql-api/import-graphql-api.png" alt-text="Screenshot of selecting GraphQL icon from list of APIs.":::
4340

4441
1. In the dialog box, select **Full** and complete the required form fields.
4542

46-
:::image type="content" source="media/graphql-api/create-from-graphql-schema.png" alt-text="Demonstrate fields for creating GraphQL":::
43+
:::image type="content" source="media/graphql-api/create-from-graphql-schema.png" alt-text="Screenshot of fields for creating a GraphQL API.":::
4744

4845
| Field | Description |
4946
|----------------|-------|
50-
| Display name | The name by which your GraphQL API will be displayed. |
51-
| Name | Raw name of the GraphQL API. Automatically populates as you type the display name. |
52-
| GraphQL API endpoint | The base URL with your GraphQL API endpoint name. <br /> For example: *`https://example.com/your-GraphQL-name`*. You can also use the common ["Star Wars" GraphQL endpoint](https://swapi-graphql.netlify.app/.netlify/functions/index) as a demo. |
53-
| Upload schema file | Select to browse and upload your schema file. |
54-
| Description | Add a description of your API. |
55-
| URL scheme | Select HTTP, HTTPS, or Both. Default selection: *Both*. |
56-
| 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. |
57-
| Base URL | Uneditable field displaying your API base URL |
58-
| Tags | Associate your GraphQL API with new or existing tags. |
59-
| Products | Associate your GraphQL API with a product to publish it. |
60-
| Gateways | Associate your GraphQL API with existing gateways. Default gateway selection: *Managed*. |
61-
| Version this API? | Select to version control your GraphQL API. |
62-
63-
1. Click **Create**.
64-
65-
## Test your GraphQL API
66-
67-
1. Navigate to your API Management instance.
68-
1. From the side navigation menu, under the **APIs** section, select **APIs**.
69-
1. Under **All APIs**, select your GraphQL API.
70-
1. Select the **Test** tab to access the Test console.
71-
1. Under **Headers**:
72-
1. Select the header from the **Name** drop-down menu.
73-
1. Enter the value to the **Value** field.
74-
1. Add more headers by selecting **+ Add header**.
75-
1. Delete headers using the **trashcan icon**.
76-
1. If you've added a product to your GraphQL API, apply product scope under **Apply product scope**.
77-
1. Under **Query editor**, either:
78-
1. Select at least one field or subfield from the list in the side menu. The fields and subfields you select appear in the query editor.
79-
1. Start typing in the query editor to compose a query.
80-
81-
:::image type="content" source="media/graphql-api/test-graphql-query.png" alt-text="Demonstrating adding fields to the query editor":::
82-
83-
1. Under **Query variables**, add variables to reuse the same query or mutation and pass different values.
84-
1. Click **Send**.
85-
1. View the **Response**.
86-
87-
:::image type="content" source="media/graphql-api/graphql-query-response.png" alt-text="View the test query response":::
88-
89-
1. Repeat preceding steps to test different payloads.
90-
1. When testing is complete, exit test console.
91-
92-
## Limitations
93-
94-
* Only GraphQL pass through is supported.
95-
* A single GraphQL API in API Management corresponds to only a single GraphQL backend endpoint.
47+
| **Display name** | The name by which your GraphQL API will be displayed. |
48+
| **Name** | Raw name of the GraphQL API. Automatically populates as you type the display name. |
49+
| **GraphQL API endpoint** | The base URL with your GraphQL API endpoint name. <br /> For example: *`https://example.com/your-GraphQL-name`*. You can also use the common ["Star Wars" GraphQL endpoint](https://swapi-graphql.netlify.app/.netlify/functions/index) as a demo. |
50+
| **Upload schema** | Optionally select to browse and upload your schema file to replace the schema retrieved from the GraphQL endpoint (if available). |
51+
| **Description** | Add a description of your API. |
52+
| **URL scheme** | Select **HTTP**, **HTTPS**, or **Both**. Default selection: *Both*. |
53+
| **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. |
54+
| **Base URL** | Uneditable field displaying your API base URL |
55+
| **Tags** | Associate your GraphQL API with new or existing tags. |
56+
| **Products** | Associate your GraphQL API with a product to publish it. |
57+
| **Gateways** | Associate your GraphQL API with existing gateways. Default gateway selection: *Managed*. |
58+
| **Version this API?** | Select to apply a versioning scheme to your GraphQL API. |
59+
60+
1. Select **Create**.
61+
1. After the API is created, browse the schema on the **Design** tab, in the **Frontend** section.
62+
:::image type="content" source="media/graphql-api/explore-schema.png" alt-text="Screenshot of exploring the GraphQL schema in the portal.":::
63+
64+
[!INCLUDE [api-management-graphql-test.md](../../includes/api-management-graphql-test.md)]
9665

9766
[!INCLUDE [api-management-define-api-topics.md](../../includes/api-management-define-api-topics.md)]
9867

0 commit comments

Comments
 (0)