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
In this tutorial, you learn about configuring common [policies](api-management-howto-policies.md) to transform your API. You might want to transform your API so it doesn't reveal private backend info. Transforming an API can help you hide the technology stack info that's running in the backend, or hide the original URLs that appear in the body of the API's HTTP response.
17
+
In this tutorial, you learn about configuring [policies](api-management-howto-policies.md) to protect or transform your API. For example, protect your backend API by configuring a rate limit policy, so that the API isn't overused by developers. You might want to transform your API so it doesn't reveal private backend info or other potentially sensitive information, or to set a custom header.
18
18
19
-
This tutorial also explains how to protect your backend API by configuring a rate limit policy, so that the API isn't overused by developers. For more policy options, see [API Management policies](api-management-policies.md).
19
+
For more policy options, see [API Management policies](api-management-policies.md).
20
20
21
21
> [!NOTE]
22
22
> By default, API Management configures a global [`forward-request`](forward-request-policy.md) policy. The `forward-request` policy is needed for the gateway to complete a request to a backend service.
23
23
24
24
In this tutorial, you learn how to:
25
25
26
26
> [!div class="checklist"]
27
-
>
28
-
> * Transform an API to strip response headers
29
-
> * Replace original URLs in the body of the API response with API Management gateway URLs
30
27
> * Protect an API by adding a rate limit policy (throttling)
28
+
> * Transform an API to set a custom response header
31
29
> * Test the transformations
32
30
33
31
:::image type="content" source="media/transform-api/api-management-console-new.png" lightbox="media/transform-api/api-management-console-new.png" alt-text="Screenshot of API Management policies in the portal.":::
@@ -41,6 +39,32 @@ In this tutorial, you learn how to:
## Protect an API by adding rate limit policy (throttling)
43
+
44
+
This section shows how to add protection to your backend API by configuring rate limits, so that the API isn't overused by developers. In this example, the limit is set to three calls per 15 seconds for each subscription ID. After 15 seconds, a developer can retry calling an API.
1. In the **Inbound processing** section, select the code editor (**</>**) icon.
48
+
49
+
:::image type="content" source="media/transform-api/inbound-policy-code.png" lightbox="media/transform-api/inbound-policy-code.png" alt-text="Screenshot of navigating to inbound policy code editor in the portal.":::
50
+
51
+
1. Position the cursor inside the **`<inbound>`** element on a blank line. Then, select **Show snippets** at the top-right corner of the screen.
52
+
53
+
:::image type="content" source="media/transform-api/show-snippets-2.png" alt-text="Screenshot of selecting show snippets in inbound policy editor in the portal.":::
54
+
55
+
1. In the right window, under **Access restriction policies**, select **Limit call rate per key**.
56
+
57
+
The **`<rate-limit-by-key />`** element is added at the cursor.
58
+
59
+
:::image type="content" source="media/transform-api/limit-call-rate-per-key.png" alt-text="Screenshot of inserting limit call rate per key policy in the portal.":::
60
+
61
+
1. Modify your **`<rate-limit-by-key />`** code in the **`<inbound>`** element to the following code. Then select **Save**.
This section shows how to hide the HTTP headers that you don't want to show to your users. For example, delete the following headers in the HTTP response:
@@ -124,30 +148,7 @@ In this example, you use the policy code editor to add the policy XML snippet di
124
148
125
149
1. Select **Save**.
126
150
127
-
## Protect an API by adding rate limit policy (throttling)
128
151
129
-
This section shows how to add protection to your backend API by configuring rate limits, so that the API isn't overused by developers. In this example, the limit is set to three calls per 15 seconds for each subscription ID. After 15 seconds, a developer can retry calling an API.
1. In the **Inbound processing** section, select the code editor (**</>**) icon.
133
-
134
-
:::image type="content" source="media/transform-api/inbound-policy-code.png" lightbox="media/transform-api/inbound-policy-code.png" alt-text="Screenshot of navigating to inbound policy code editor in the portal.":::
135
-
136
-
1. Position the cursor inside the **`<inbound>`** element on a blank line. Then, select **Show snippets** at the top-right corner of the screen.
137
-
138
-
:::image type="content" source="media/transform-api/show-snippets-2.png" alt-text="Screenshot of selecting show snippets in inbound policy editor in the portal.":::
139
-
140
-
1. In the right window, under **Access restriction policies**, select **Limit call rate per key**.
141
-
142
-
The **`<rate-limit-by-key />`** element is added at the cursor.
143
-
144
-
:::image type="content" source="media/transform-api/limit-call-rate-per-key.png" alt-text="Screenshot of inserting limit call rate per key policy in the portal.":::
145
-
146
-
1. Modify your **`<rate-limit-by-key />`** code in the **`<inbound>`** element to the following code. Then select **Save**.
0 commit comments