|
1 | 1 | ---
|
2 |
| -title: Add an API manually using the Azure portal | Microsoft Docs |
3 |
| -description: This tutorial shows you how to use API Management to add an API manually. |
| 2 | +title: Manually Add an API by Using the Azure portal | Microsoft Docs |
| 3 | +description: Learn how to use Azure API Management in the Azure portal to manually add an API. Add and test various operations. |
4 | 4 | services: api-management
|
5 | 5 | author: dlepow
|
6 | 6 |
|
7 | 7 | ms.service: azure-api-management
|
8 | 8 | ms.topic: how-to
|
9 |
| -ms.date: 06/30/2022 |
| 9 | +ms.date: 05/16/2025 |
10 | 10 | ms.author: danlep
|
11 | 11 | ms.custom: fasttrack-edit, devdivchpfy22
|
12 | 12 |
|
| 13 | + |
| 14 | +#customer intent: As an API developer, I want to use API Management to manually add an API. |
13 | 15 | ---
|
14 | 16 |
|
15 |
| -# Add an API manually |
| 17 | +# Manually add an API |
16 | 18 |
|
17 | 19 | [!INCLUDE [api-management-availability-all-tiers](../../includes/api-management-availability-all-tiers.md)]
|
18 | 20 |
|
19 |
| -This article shows steps to add an API manually to the API Management instance. When you want to mock the API, you can create a blank API or define it manually. For details about mocking an API, see [Mock API responses](mock-api-responses.md). |
| 21 | +This article shows how to manually add an API to Azure API Management. When you want to create mock responses from the API, you can create a blank API. For information about creating mock API responses, see [Mock API responses](mock-api-responses.md). |
20 | 22 |
|
21 |
| -If you want to import an existing API, see [related content](#related-content) section. |
| 23 | +If you want to import an existing API, see the [Related content](#related-content) section of this article. |
22 | 24 |
|
23 |
| -In this article, we create a blank API and specify [httpbin.org](https://httpbin.org) (a public testing service) as a backend API. |
| 25 | +In this article, you learn how to create a blank API. You'll specify [httpbin.org](https://httpbin.org) (a public testing service) as a backend API. |
24 | 26 |
|
25 | 27 | ## Prerequisites
|
26 | 28 |
|
27 |
| -Complete the following quickstart: [Create an Azure API Management instance](get-started-create-service-instance.md) |
| 29 | +- Complete the [Create an Azure API Management instance](get-started-create-service-instance.md) quickstart. |
28 | 30 |
|
29 | 31 | [!INCLUDE [api-management-navigate-to-instance.md](../../includes/api-management-navigate-to-instance.md)]
|
30 | 32 |
|
31 | 33 | ## Create an API
|
32 | 34 |
|
33 |
| -1. Navigate to your API Management service in the Azure portal and select **APIs** from the menu. |
34 |
| -2. From the left menu, select **+ Add API**. |
35 |
| -3. Select **HTTP** from the list. |
36 |
| -  |
37 |
| -4. Enter the backend **Web service URL** (for example, `https://httpbin.org`) and other settings for the API. The settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial. |
38 |
| -5. Select **Create**. |
| 35 | +1. Under **APIs** in the left menu, select **APIs**. |
| 36 | +1. Select **+ Add API**. |
| 37 | +1. Select the **HTTP** tile: |
| 38 | + |
| 39 | + :::image type="content" source="media/add-api-manually/blank-api-1.png" alt-text="Screenshot that shows the HTTP tile in the Azure portal."::: |
| 40 | + |
| 41 | +1. Enter the backend **Web service URL** (for example, `https://httpbin.org`) and other settings for the API. The settings are explained in the [Import and publish your first API](import-and-publish.md#import-and-publish-a-backend-api) tutorial. |
| 42 | +1. Select **Create**. |
39 | 43 |
|
40 |
| -At this point, you have no operations in API Management that map to the operations in your backend API. If you call an operation that is exposed through the back end but not through the API Management, you get a **404**. |
| 44 | +At this point, you have no operations in API Management that map to the operations in your backend API. If you call an operation that's exposed through the backend but not through API Management, you get a 404 error. |
41 | 45 |
|
42 | 46 | >[!NOTE]
|
43 |
| -> By default, when you add an API, even if it's connected to some backend service, API Management won't expose any operations until you allow them. To allow an operation of your backend service, create an API Management operation that maps to the backend operation. |
| 47 | +> By default, when you add an API, even if it's connected to a backend service, API Management won't expose any operations until you allow them. To allow an operation of your backend service, create an API Management operation that maps to the backend operation. |
44 | 48 |
|
45 | 49 | ## Add and test an operation
|
46 | 50 |
|
47 |
| -This section shows how to add a "/get" operation to map it to the back end "http://httpbin.org/get" operation. |
| 51 | +This section shows how to add a `/get` operation to map it to the backend `http://httpbin.org/get` operation. |
48 | 52 |
|
49 | 53 | ### Add an operation
|
50 | 54 |
|
51 | 55 | 1. Select the API you created in the previous step.
|
52 |
| -2. Select **+ Add Operation**. |
53 |
| -3. In the **URL**, select **GET** and enter `/get` in the resource. |
54 |
| -4. Enter "*FetchData*" for **Display name**. |
55 |
| -5. Select **Save**. |
| 56 | +1. Select **+ Add operation**. |
| 57 | +1. In **URL**, select **GET** and enter **/get** in the text box. |
| 58 | +1. In **Display name**, enter **FetchData**. |
| 59 | +1. Select **Save**. |
56 | 60 |
|
57 |
| -### Test an operation |
| 61 | +### Test the operation |
58 | 62 |
|
59 |
| -Test the operation in the Azure portal. You can also test it in the **Developer portal**. |
| 63 | +Test the operation in the Azure portal. (You can also test it in the developer portal.) |
60 | 64 |
|
61 | 65 | 1. Select the **Test** tab.
|
62 |
| -2. Select **FetchData**. |
63 |
| -3. Press **Send**. |
| 66 | +1. Select **FetchData**. |
| 67 | +1. Select **Send**. |
64 | 68 |
|
65 |
| -The response that the "http://httpbin.org/get" operation generates appears. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
| 69 | +The response that the `http://httpbin.org/get` operation generates appears in the **HTTP response** section. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
66 | 70 |
|
67 | 71 | ## Add and test a parameterized operation
|
68 | 72 |
|
69 |
| -This section shows how to add an operation that takes a parameter. In this case, we map the operation to "http://httpbin.org/status/200". |
| 73 | +This section shows how to add an operation that takes a parameter. In this example, you map the operation to `http://httpbin.org/status/200`. |
70 | 74 |
|
71 |
| -### Add the operation |
| 75 | +### Add an operation |
72 | 76 |
|
73 |
| -1. Select the API you created in the previous step. |
74 |
| -2. Select **+ Add Operation**. |
75 |
| -3. In the **URL**, select **GET** and enter `/status/{code}` in the resource. Optionally, you can provide some information associated with this parameter. For example, enter "*Number*" for **TYPE**, "*200*" (default) for **VALUES**. |
76 |
| -4. Enter "GetStatus" for **Display name**. |
77 |
| -5. Select **Save**. |
| 77 | +1. Select the API that you created earlier. |
| 78 | +1. On the **Design** tab, select **+ Add operation**. |
| 79 | +1. In **URL**, select **GET** and enter **/status/{code}** in the text box. |
| 80 | +1. In **Display name**, enter **GetStatus**. |
| 81 | +1. Select **Save**. |
78 | 82 |
|
79 | 83 | ### Test the operation
|
80 | 84 |
|
81 |
| -Test the operation in the Azure portal. You can also test it in the **Developer portal**. |
| 85 | +Test the operation in the Azure portal. (You can also test it in the developer portal.) |
82 | 86 |
|
83 | 87 | 1. Select the **Test** tab.
|
84 |
| -2. Select **GetStatus**. By default the code value is set to "*200*". You can change it to test other values. For example, type "*418*". |
85 |
| -3. Press **Send**. |
| 88 | +1. Select **GetStatus**. In **code**, enter **200**. |
| 89 | +1. Select **Send**. |
86 | 90 |
|
87 |
| - The response that the "http://httpbin.org/status/200" operation generates appears. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
| 91 | + The response that the `http://httpbin.org/status/200` operation generates appears in the **HTTP response** section. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
88 | 92 |
|
89 | 93 | ## Add and test a wildcard operation
|
90 | 94 |
|
91 |
| -This section shows how to add a wildcard operation. A wildcard operation lets you pass an arbitrary value with an API request. Instead of creating separate GET operations as shown in the previous sections, you could create a wildcard GET operation. |
| 95 | +This section shows how to add a wildcard operation. A wildcard operation enables you to pass an arbitrary value with an API request. Instead of creating separate GET operations as shown in the previous sections, you could create a wildcard GET operation. |
92 | 96 |
|
93 | 97 | > [!CAUTION]
|
94 |
| -> Use care when configuring a wildcard operation. This configuration may make an API more vulnerable to certain [API security threats](mitigate-owasp-api-threats.md#improper-inventory-management). |
| 98 | +> Be cautious when you configure a wildcard operation. This configuration might make an API more vulnerable to certain [API security threats](mitigate-owasp-api-threats.md#improper-inventory-management). |
95 | 99 |
|
96 |
| -### Add the operation |
| 100 | +### Add an operation |
97 | 101 |
|
98 |
| -1. Select the API you created in the previous step. |
99 |
| -2. Select **+ Add Operation**. |
100 |
| -3. In the **URL**, select **GET** and enter `/*` in the resource. |
101 |
| -4. Enter "*WildcardGet*" for **Display name**. |
102 |
| -5. Select **Save**. |
| 102 | +1. Select the API you created earlier. |
| 103 | +1. On the **Design** tab, select **+ Add operation**. |
| 104 | +1. In **URL**, select **GET** and enter **/*** in the text box. |
| 105 | +1. In **Display name**, enter **WildcardGet**. |
| 106 | +1. Select **Save**. |
103 | 107 |
|
104 | 108 | ### Test the operation
|
105 | 109 |
|
106 |
| -Test the operation in the Azure portal. You can also test it in the **Developer portal**. |
| 110 | +Test the operation in the Azure portal. (You can also test it in the developer portal.) |
107 | 111 |
|
108 | 112 | 1. Select the **Test** tab.
|
109 |
| -2. Select **WildcardGet**. Try the GET operations that you tested in previous sections, or try a different supported GET operation. |
| 113 | +1. Select **WildcardGet**. Try the GET operations that you tested in previous sections, or try a different supported GET operation. |
110 | 114 |
|
111 |
| - For example, in **Template parameters**, update the value next to the wildcard (*) name to `headers`. The operation returns the incoming request's HTTP headers. |
112 |
| -1. Press **Send**. |
| 115 | + For example, in **Template parameters**, change the value next to the wildcard (*) name to **headers**. The operation returns the incoming request's HTTP headers. |
| 116 | +1. Select **Send**. |
113 | 117 |
|
114 |
| - The response that the "http://httpbin.org/headers" operation generates appears. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
| 118 | + The response that the `http://httpbin.org/headers` operation generates appears in the **HTTP response** section. If you want to transform your operations, see [Transform and protect your API](transform-api.md). |
115 | 119 |
|
116 | 120 | >[!NOTE]
|
117 | 121 | > It can be important to understand how the host for the backend API you're integrating with handles trailing slashes on an operation URL. For more information, see this [API Management FAQ](./api-management-faq.yml#how-does-api-management-handle-trailing-slashes-when-calling-backend-services-).
|
|
0 commit comments