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
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 or define it manually. 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.
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
+
:::image type="content" source="media/add-api-manually/blank-api-1.png" alt-text="Screenshot that shows the HTTP tile in the Azure portal.":::
39
+
40
+
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.
41
+
1. Select **Create**.
39
42
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**.
43
+
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
44
42
45
>[!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.
46
+
> 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
47
45
48
## Add and test an operation
46
49
47
-
This section shows how to add a "/get" operation to map it to the back end "http://httpbin.org/get" operation.
50
+
This section shows how to add a `/get` operation to map it to the backend `http://httpbin.org/get` operation.
48
51
49
52
### Add an operation
50
53
51
54
1. Select the API you created in the previous step.
52
55
2. Select **+ Add Operation**.
53
56
3. In the **URL**, select **GET** and enter `/get` in the resource.
54
-
4.Enter "*FetchData*" for **Display name**.
57
+
4.In **Display name**, enter **FetchData**.
55
58
5. Select **Save**.
56
59
57
-
### Test an operation
60
+
### Test the operation
58
61
59
-
Test the operation in the Azure portal. You can also test it in the **Developer portal**.
62
+
Test the operation in the Azure portal. (You can also test it in the developer portal.)
60
63
61
64
1. Select the **Test** tab.
62
65
2. Select **FetchData**.
63
-
3.Press**Send**.
66
+
3.Select**Send**.
64
67
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).
68
+
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).
66
69
67
70
## Add and test a parameterized operation
68
71
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".
72
+
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
73
71
-
### Add the operation
74
+
### Add an operation
72
75
73
-
1. Select the API you created in the previous step.
76
+
1. Select the API that you created earlier.
74
77
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**.
78
+
3. In the **URL**, select **GET** and enter `/status/{code}` in the resource. Optionally, you can provide information that's associated with the parameter. For example, enter **Number** under**TYPE** and **200** (the default) under**VALUES**.
79
+
4.In **Display name**, enter **GetStatus**.
77
80
5. Select **Save**.
78
81
79
82
### Test the operation
80
83
81
-
Test the operation in the Azure portal. You can also test it in the **Developer portal**.
84
+
Test the operation in the Azure portal. (You can also test it in the developer portal.)
82
85
83
86
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**.
87
+
2. Select **GetStatus**. By default, the code value is set to **200**. You can change it to test other values. For example, type **418**.
88
+
3.Select**Send**.
86
89
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).
90
+
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).
88
91
89
92
## Add and test a wildcard operation
90
93
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.
94
+
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
95
93
96
> [!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).
97
+
> 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
98
96
-
### Add the operation
99
+
### Add an operation
97
100
98
-
1. Select the API you created in the previous step.
101
+
1. Select the API you created earlier.
99
102
2. Select **+ Add Operation**.
100
103
3. In the **URL**, select **GET** and enter `/*` in the resource.
101
-
4.Enter "*WildcardGet*" for **Display name**.
104
+
4.In **Display name**, enter **WildcardGet**.
102
105
5. Select **Save**.
103
106
104
107
### Test the operation
105
108
106
-
Test the operation in the Azure portal. You can also test it in the **Developer portal**.
109
+
Test the operation in the Azure portal. (You can also test it in the developer portal.)
107
110
108
111
1. Select the **Test** tab.
109
112
2. Select **WildcardGet**. Try the GET operations that you tested in previous sections, or try a different supported GET operation.
110
113
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.
114
+
For example, in **Template parameters**, change the value next to the wildcard (*) name to `headers`. The operation returns the incoming request's HTTP headers.
112
115
1. Press **Send**.
113
116
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).
117
+
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).
115
118
116
119
>[!NOTE]
117
120
> 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