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
-[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.
Copy file name to clipboardExpand all lines: articles/api-management/graphql-api.md
+30-61Lines changed: 30 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,18 @@
1
1
---
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
3
3
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.
5
5
ms.service: api-management
6
6
author: dlepow
7
7
ms.author: danlep
8
8
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
11
11
---
12
12
13
-
# Import a GraphQL API (preview)
13
+
# Import a GraphQL API
14
14
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.
> * Learn the limitations of your GraphQL API in API Management.
30
23
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
+
31
26
## Prerequisites
32
27
33
28
- An existing API Management instance. [Create one if you haven't already](get-started-create-service-instance.md).
1. From the side navigation menu, under the **APIs** section, select **APIs**.
40
37
1. Under **Define a new API**, select the **GraphQL** icon.
41
38
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.":::
43
40
44
41
1. In the dialog box, select **Full** and complete the required form fields.
45
42
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.":::
47
44
48
45
| Field | Description |
49
46
|----------------|-------|
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. |
| 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. |
|**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.":::
0 commit comments