Skip to content

Commit d59ce7e

Browse files
Freshness.
1 parent 616beb3 commit d59ce7e

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

articles/api-management/transform-api.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Tutorial - Transform and protect your API in Azure API Management
2+
title: "Tutorial: Transform and protect your API in Azure API Management"
33
description: In this tutorial, you learn how to protect your API in API Management with transformation and throttling (rate-limiting) policies.
4-
54
author: dlepow
65
ms.service: azure-api-management
76
ms.topic: tutorial
8-
ms.date: 11/25/2024
7+
ms.date: 02/09/2026
98
ms.author: danlep
109
ms.custom:
1110
- mvc
1211
- devdivchpfy22
1312
- sfi-image-nochange
13+
#customer intent: As an API developer responsible for an API, I need to use policies to manage access and use of APIs in API Management.
1414
---
1515

1616
# Tutorial: Transform and protect your API
@@ -21,41 +21,42 @@ In this tutorial, you learn about configuring [policies](api-management-howto-po
2121

2222
[!INCLUDE [api-management-workspace-try-it](../../includes/api-management-workspace-try-it.md)]
2323

24-
For example, you might want to set a custom response header. Or, protect your backend API by configuring a rate limit policy, so that the API isn't overused by developers. These examples are a simple introduction to API Management policies. For more policy options, see [API Management policies](api-management-policies.md).
24+
For example, you might want to set a custom response header. Or, configure a rate limit policy to protect your backend API, so developers don't overuse the API. These examples are a simple introduction to API Management policies. For more policy options, see [API Management policies](api-management-policies.md).
2525

2626
> [!NOTE]
2727
> 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.
2828
2929
In this tutorial, you learn how to:
3030

3131
> [!div class="checklist"]
32-
> * Transform an API to set a custom response header
33-
> * Protect an API by adding a rate limit policy (throttling)
34-
> * Test the transformations
32+
> - Transform an API to set a custom response header
33+
> - Protect an API by adding a rate limit policy, or *throttling*
34+
> - Test the transformations
3535
3636
:::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.":::
3737

3838
## Prerequisites
3939

40-
* Learn the [Azure API Management terminology](api-management-terminology.md).
41-
* Understand the [concept of policies in Azure API Management](api-management-howto-policies.md).
42-
* Complete the following quickstart: [Create an Azure API Management instance](get-started-create-service-instance.md). For this tutorial, we recommend that you use one of the classic or v2 tiers, for example, the Developer tier or the Basic v2 tier. The Consumption tier doesn't support all policies used in this tutorial.
43-
* Also, complete the following tutorial: [Import and publish your first API](import-and-publish.md).
40+
- Learn the [Azure API Management terminology](api-management-terminology.md).
41+
- Understand the [concept of policies in Azure API Management](api-management-howto-policies.md).
42+
- Complete the following quickstart: [Create an Azure API Management instance](get-started-create-service-instance.md). For this tutorial, we recommend that you use one of the classic or v2 tiers, for example, the Developer tier or the Basic v2 tier. The Consumption tier doesn't support all policies used in this tutorial.
43+
- Complete the following tutorial: [Import and publish your first API](import-and-publish.md).
4444

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

4747
## Test the original response
4848

4949
To see the original response:
5050

51-
1. In your API Management service instance, select **APIs**.
52-
1. Select **Swagger Petstore** from your API list.
53-
1. Select the **Test** tab, on the top of the screen.
54-
1. Select the **GET Finds pets by status** operation, and optionally select a different value of the *status* **Query parameter**. Select **Send**.
51+
1. In your API Management service instance, select **APIs** > **APIs**.
52+
1. From your API list, select **Swagger Petstore**.
53+
1. At the top of the screen, select **Test**.
54+
1. Select the **GET Finds Pets by status** operation, and optionally select a different value of the *status* **Query parameter**.
55+
1. Select **Send**.
5556

5657
The original API response should look similar to the following response:
5758

58-
:::image type="content" source="media/transform-api/test-original-response-new.png" lightbox="media/transform-api/test-original-response-new.png" alt-text="Screenshot of the original API response in the portal.":::
59+
:::image type="content" source="media/transform-api/test-original-response-new.png" lightbox="media/transform-api/test-original-response-new.png" alt-text="Screenshot of the original API response in the Azure portal.":::
5960

6061
## Transform an API to add a custom response header
6162

@@ -74,19 +75,19 @@ This section shows you how to configure a custom response header using the `set-
7475

7576
:::image type="content" source="media/transform-api/set-http-header.png" alt-text="Screenshot of configuring the Set headers policy in the portal.":::
7677

77-
1. To configure the Set headers policy, do the following:
78-
1. Under **Name**, enter **Custom**.
79-
1. Under **Value**, select **+ Add value**. Enter *"My custom value"*.
80-
1. Select **Save**.
78+
1. To configure the Set headers policy:
79+
80+
1. Under **Name**, enter *Custom*.
81+
1. Under **Value**, select **+ Add value**. Enter *\<My custom value>*.
82+
1. Select **Save**.
8183

82-
1. After configuration, a **set-header** policy element appears in the **Outbound processing** section.
84+
After configuration, a **set-header** policy element appears in the **Outbound processing** section.
8385

8486
:::image type="content" source="media/transform-api/set-policy.png" alt-text="Screenshot of the Set headers outbound policies in the portal.":::
8587

86-
8788
## Protect an API by adding rate limit policy (throttling)
8889

89-
This section shows how to add protection to your backend API by configuring rate limits, so that the API isn't overused by developers. This example shows how to configure the `rate-limit-by-key` policy using the code editor. In this example, the limit is set to three calls per 15 seconds. After 15 seconds, a developer can retry calling the API.
90+
This section shows how to add protection to your backend API by configuring rate limits, so that developers don't overuse the API. This example shows how to configure the `rate-limit-by-key` policy using the code editor. In this example, the limit is set to three calls per 15 seconds. After 15 seconds, a developer can retry calling the API.
9091

9192
> [!NOTE]
9293
> This policy isn't supported in the Consumption tier.
@@ -96,23 +97,22 @@ This section shows how to add protection to your backend API by configuring rate
9697

9798
:::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.":::
9899

99-
1. Position the cursor inside the **`<inbound>`** element on a blank line. Then, select **Show snippets** at the top-right corner of the screen.
100+
1. Position the cursor inside the **\<inbound>** element on a blank line. Then, select **Show snippets** at the top-right corner of the screen.
100101

101102
:::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.":::
102103

103104
1. In the right window, under **Access restriction policies**, select **Limit call rate per key**.
104105

105-
The **`<rate-limit-by-key />`** element is added at the cursor.
106+
The **\<rate-limit-by-key />** element is added at the cursor.
106107

107108
:::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.":::
108109

109-
1. Modify your **`<rate-limit-by-key />`** code in the **`<inbound>`** element to the following code. Then select **Save**.
110+
1. Modify your **\<rate-limit-by-key />** code in the **`<inbound>`** element to the following code. Then select **Save**.
110111

111112
```xml
112113
<rate-limit-by-key calls="3" renewal-period="15" counter-key="@(context.Subscription.Id)" />
113114
```
114115

115-
116116
## Test the transformations
117117

118118
At this point, if you look at the code in the code editor, your policies look like the following code:
@@ -140,7 +140,7 @@ The rest of this section tests policy transformations that you set in this artic
140140
### Test the custom response header
141141

142142
1. Select **Swagger Petstore** > **Test**.
143-
1. Select the **GET Finds pets by status** operation, and optionally select a different value of the *status* **Query parameter**. Select **Send**.
143+
1. Select the **GET Finds Pets by status** operation, and optionally select a different value of the *status* **Query parameter**. Select **Send**.
144144

145145
As you can see, the custom response header is added:
146146

@@ -150,7 +150,7 @@ The rest of this section tests policy transformations that you set in this artic
150150
### Test the rate limit (throttling)
151151

152152
1. Select **Swagger Petstore** > **Test**.
153-
1. Select the **GET Finds Pets by Status** operation. Select **Send** several times in a row.
153+
1. Select the **GET Finds Pets by status** operation. Select **Send** several times in a row.
154154

155155
After sending too many requests in the configured period, you get the **429 Too Many Requests** response.
156156

@@ -166,11 +166,11 @@ In this tutorial, you learned how to:
166166

167167
> [!div class="checklist"]
168168
>
169-
> * Transform an API to set a custom response header
170-
> * Protect an API by adding a rate limit policy (throttling)
171-
> * Test the transformations
169+
> - Transform an API to set a custom response header
170+
> - Protect an API by adding a rate limit policy (throttling)
171+
> - Test the transformations
172172
173-
## Next steps
173+
## Next step
174174

175175
Advance to the next tutorial:
176176

0 commit comments

Comments
 (0)