Skip to content

Commit 12ba8e4

Browse files
author
gitName
committed
wip
1 parent a971800 commit 12ba8e4

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed
277 Bytes
Loading
647 Bytes
Loading
-366 Bytes
Loading
-225 Bytes
Loading
-7.63 KB
Loading

articles/api-management/transform-api.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,26 @@ author: dlepow
66
ms.service: azure-api-management
77
ms.custom: mvc, devdivchpfy22
88
ms.topic: tutorial
9-
ms.date: 07/30/2024
9+
ms.date: 11/18/2024
1010
ms.author: danlep
1111
---
1212

1313
# Tutorial: Transform and protect your API
1414

1515
[!INCLUDE [api-management-availability-all-tiers](../../includes/api-management-availability-all-tiers.md)]
1616

17-
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.
1818

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).
2020

2121
> [!NOTE]
2222
> 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.
2323
2424
In this tutorial, you learn how to:
2525

2626
> [!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
3027
> * Protect an API by adding a rate limit policy (throttling)
28+
> * Transform an API to set a custom response header
3129
> * Test the transformations
3230
3331
:::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:
4139

4240
[!INCLUDE [api-management-navigate-to-instance.md](../../includes/api-management-navigate-to-instance.md)]
4341

42+
## 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.
45+
46+
1. Select **Petstore API** > **Design** > **All operations**.
47+
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**.
62+
63+
```
64+
<rate-limit-by-key calls="3" renewal-period="15" counter-key="@(context.Subscription.Id)" />
65+
```
66+
67+
4468
## Transform an API to strip response headers
4569
4670
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
124148
125149
1. Select **Save**.
126150
127-
## Protect an API by adding rate limit policy (throttling)
128151
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.
130-
131-
1. Select **Demo Conference API** > **Design** > **All operations**.
132-
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**.
147-
148-
```
149-
<rate-limit-by-key calls="3" renewal-period="15" counter-key="@(context.Subscription.Id)" />
150-
```
151152
152153
## Test the transformations
153154

0 commit comments

Comments
 (0)