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
[Azure Container Apps](../container-apps/overview.md) allows you to deploy containerized apps without managing complex infrastructure. API developers can write code using their preferred programming language or framework, build microservices with full support for Distributed Application Runtime (Dapr), and scale based on HTTP traffic or other events.
30
32
31
-
API Management is the recommended environment to expose a Container App hosted web API, for several reasons:
33
+
By using API Management to expose a web API that's hosted in a container app, you gain the following benenfits:
32
34
33
-
* Decouple managing and securing the front end exposed to API consumers from managing and monitoring the backend web API
34
-
* Manage web APIs hosted as Container Apps in the same environment as your other APIs
35
-
* Apply [policies](api-management-policies.md) to change API behavior, such as callrate limiting
36
-
* Direct API consumers to API Management's customizable [developer portal](api-management-howto-developer-portal.md)to discover and learn about your APIs, request access, and try them
35
+
* Decouple managing and securing the frontend that's exposed to API consumers from managing and monitoring the backend web API.
36
+
* Manage web APIs hosted as container apps in the same environment as your other APIs.
37
+
* Apply [policies](api-management-policies.md) to change API behavior, such as call-rate limiting.
38
+
* Direct API consumers to the customizable API Management[developer portal](api-management-howto-developer-portal.md)so they can discover and learn about your APIs, request access, and try APIs.
37
39
38
40
For more information, see [About API Management](api-management-key-concepts.md).
39
41
40
-
## OpenAPI specification versus wildcard operations
42
+
## OpenAPI specification vs. wildcard operations
41
43
42
-
API Management supports import of Container Apps that provide an OpenAPI specification (Swagger definition). However, an OpenAPI specification isn't required. We recommend providing an OpenAPI specification. API Management can import individual operations, allowing you to validate, manage, secure, and update configurations for each operation separately.
44
+
API Management supports importing container apps that provide an OpenAPI specification (a Swagger definition). However, an OpenAPI specification isn't required. We recommend that you provide an OpenAPI specification. API Management can import individual operations, which allows you to validate, manage, secure, and update configurations for each operation separately.
43
45
44
-
If the Container App exposes an OpenAPI specification, API Management creates API operations that map directly to the definition. API Management will look in several locations for an OpenAPI Specification
46
+
If the container app exposes an OpenAPI specification, API Management creates API operations that map directly to the definition. API Management will look in several locations for an OpenAPI specification:
45
47
46
-
* The Container App configuration.
48
+
* The container app configuration
47
49
*`/openapi.json`
48
50
*`/openapi.yml`
49
51
*`/swagger/v1/swagger.json`
50
52
51
53
If an OpenAPI specification isn't provided, API Management generates [wildcard operations](add-api-manually.md#add-and-test-a-wildcard-operation) for the common HTTP verbs (GET, PUT, and so on). You can still take advantage of the same API Management features, but operations aren't defined at the same level of detail.
52
54
53
-
In either case, you can [edit](edit-api.md) or [add](add-api-manually.md) operations to the API after import.
55
+
In either case, you can [edit](edit-api.md) or [add](add-api-manually.md) operations to the API after you import it.
54
56
55
57
### Example
56
58
57
-
Your backend Container App might support two GET operations:
59
+
Your backend container app might support two GET operations:
You import the Container App to your API Management service at a path such as`https://contosoapi.azure-api.net/store`. The following table shows the operations that are imported to API Management, either with or without an OpenAPI specification:
64
+
You import the container app to your API Management service at a path like`https://contosoapi.azure-api.net/store`. The following table shows the operations that are imported to API Management, either with or without an OpenAPI specification:
The wildcard operation allows the same requests to the backend service as the operations in the OpenAPI specification. However, the OpenAPI-specified operations can be managed separately in API Management.
70
72
71
73
## Prerequisites
72
74
73
-
+ Complete the following quickstart: [Create an Azure API Management instance](get-started-create-service-instance.md).
74
-
+ Make sure there's a Container App that exposes a Web API in your subscription. For more information, see [Container Apps documentation](../container-apps/index.yml).
+ Complete the [Create an Azure API Management instance](get-started-create-service-instance.md) quickstart.
76
+
+ Make sure there's a container app that exposes a web API in your subscription. For more information, see [Container Apps documentation](../container-apps/index.yml).
77
77
78
-
## <aname="create-api"> </a>Import and publish a backend API
78
+
## Import and publish a backend API
79
79
80
-
1. Navigate to your API Management service in the Azure portal and select **APIs**from the menu.
81
-
2. Select**Container App** from the list.
80
+
1. Navigate to your API Management service in the Azure portal and select **APIs**> **APIs** in the left pane.
81
+
1. Under**Create from Azure resource**, select **Container App**:
82
82
83
-
:::image type="content" source="media/import-container-app-with-oas/add-api.png" alt-text="Create from Container App":::
83
+
:::image type="content" source="media/import-container-app-with-oas/add-api.png" alt-text="Screenshot that shows the Container App tile.":::
84
84
85
-
3. Select **Browse** to see the list of Container Apps in your subscription.
86
-
4. Select a Container App. If an OpenAPI definition is associated with the selected Container App, API Management fetches it and imports it. If an OpenAPI definition isn't found, API Management exposes the API by generating wildcard operations for common HTTP verbs.
87
-
1. Add an API URL suffix. The suffix is a name that identifies this specific API in this API Management instance. It has to be unique in this API Management instance.
88
-
2. Publish the API by associating the API with a product. In this case, the "*Unlimited*" product is used. If you want the API to be published and be available to developers, add it to a product.
85
+
1. Select **Browse** to see a list of container apps in your subscription.
86
+
1. Select a container app. If an OpenAPI definition is associated with the selected container app, API Management fetches it and imports it. If an OpenAPI definition isn't found, API Management exposes the API by generating wildcard operations for common HTTP verbs.
87
+
1. Add an **API URL suffix**. The suffix is a name that identifies the API in the API Management instance. It has to be unique in the API Management instance.
88
+
1. Publish the API by associating the API with a product. In this case, the **Unlimited** product is used. If you want the API to be published and be available to developers, add it to a product.
89
89
90
90
> [!NOTE]
91
-
> Products are associations of one or more APIs. You can include many APIs and offer them to developers through the developer portal. Developers must first subscribe to a product to get access to the API. When they subscribe, they get a subscription key that is good for any API in that product. If you created the API Management instance, you're an administrator and subscribed to every product by default.
91
+
> *Products* are associations of one or more APIs. You can include many APIs and offer them to developers through the developer portal. Developers must first subscribe to a product to get access to the API. When they subscribe, they get a subscription key that is good for any API in that product. If you created the API Management instance, you're an administrator and subscribed to every product by default.
92
92
>
93
-
> Each API Management instance comes with two sample products when created:
93
+
> In some pricing tiers, an API Management instance comes with two sample products when you create it:
94
94
> ***Starter**
95
95
> ***Unlimited**
96
96
97
-
3. Enter other API settings. You can set the values during creation or configure them later by going to the **Settings** tab. The settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial.
98
-
4. Select **Create**.
97
+
1. Enter other API settings. You can set these values when you create the API or configure them later on the **Settings** tab. These settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial.
98
+
1. Select **Create**.
99
99
100
-
:::image type="content" source="media/import-container-app-with-oas/import-container-app.png" alt-text="Create API from Container App":::
100
+
:::image type="content" source="media/import-container-app-with-oas/import-container-app.png" alt-text="Screenshot that shows the Create from Container App window." lightbox="media/import-container-app-with-oas/import-container-app.png":::
101
101
102
102
## Test the new API in the Azure portal
103
103
104
-
Operations can be called directly from the Azure portal, which provides a convenient way to view and test the operations of an API. You can also test the API in the [developer portal](api-management-howto-developer-portal.md) or using your own REST client tools.
104
+
Operations can be called directly from the Azure portal. This method is a convenient way to view and test the operations of an API. You can also test the API in the [developer portal](api-management-howto-developer-portal.md) or by using your own REST client tools.
105
+
106
+
To test the API in the Azure portal:
105
107
106
108
1. Select the API you created in the previous step.
107
109
1. Select the **Test** tab.
108
110
1. Select an operation.
109
111
110
-
The page displays fields for query parameters and fields for the headers. One of the headers is `Ocp-Apim-Subscription-Key`, for the subscription key of the product that is associated with this API. If you created the API Management instance, you are an administrator already, so the key is filled in automatically.
112
+
The page displays fields for query parameters and fields for the headers. One of the headers is `Ocp-Apim-Subscription-Key`. This header is for the subscription key of the product that's associated with the API. If you created the API Management instance, you are an administrator, so the key is filled in automatically.
111
113
112
-
1.Press**Send**.
114
+
1.Select**Send**.
113
115
114
116
When the test is successful, the backend responds with **200 OK** and some data.
115
117
@@ -119,16 +121,16 @@ When wildcard operations are generated, the operations might not map directly to
119
121
120
122
`/api/TodoItems`
121
123
122
-
You can test the path `/api/TodoItems` as follows.
124
+
You can test the path `/api/TodoItems` as follows:
123
125
124
-
1. Select the API you created, and select the operation.
126
+
1. Select the API that you created, and then select the operation.
125
127
1. Select the **Test** tab.
126
-
1. In **Template parameters**, update the value next to the wildcard (*) name. For example, enter `api/TodoItems`. This value gets appended to the path `/` for the wildcard operation.
128
+
1. In **Template parameters**, update the value next to the wildcard (*) name. For example, enter `api/TodoItems`. This value is appended to the path `/` for the wildcard operation.
:::image type="content" source="media/import-container-app-with-oas/test-wildcard-operation.png" alt-text="Screenshot that shows the steps for testing wildcard operation." lightbox="media/import-container-app-with-oas/test-wildcard-operation.png":::
0 commit comments