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
Copy file name to clipboardExpand all lines: learn-pr/azure/improve-api-performance-with-apim-caching-policy/includes/2-choose-the-right-api-management-policy.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
You can use API Management policies to control the behavior of a deployed API without rewriting its code.
2
2
3
-
In your board game company, you have a set of APIs that enable partner organizations to obtain price estimates, staff members to check stock levels, and customers to place orders. You want to address a particular issue with performance and investigate what else you can achieve with policies.
3
+
In your board game company, your APIs enable partner organizations to obtain price estimates, staff members to check stock levels, and customers to place orders. You want to address a particular issue with performance and investigate what else you can achieve with policies.
4
4
5
5
First, let's look at what you can use policies to do.
6
6
7
7
## What are policies?
8
8
9
-
In Azure API Management, administrators can use policies to alter the behavior of APIs through configuration. The primary functionality and behavior of an API is designed by the developers who write the code. However, administrators can use policies to set limits, convert response formats, or enforce security requirements. In this module, we concentrate on using policies to set up and control a cache.
9
+
In Azure API Management, administrators can use policies to alter the behavior of APIs through configuration. Developers design the primary functionality and behavior of an API by writing code. However, administrators can use policies to set limits, convert response formats, or enforce security requirements. In this module, we concentrate on using policies to set up and control a cache.
10
10
11
11
Policies are made up of individual statements, which are executed in order. The policy documents are XML structures, which contain elements that you can use to control the behavior of the API.
12
12
@@ -47,7 +47,7 @@ This policy also translates any outbound responses in JSON format into XML.
47
47
48
48
## Policy scopes
49
49
50
-
A policy's scope determines how broadly it's applied. The following are policy scopes from which you can choose:
50
+
A policy scope determines how broadly the policy is applied. You can choose from the following policy scopes:
51
51
52
52
- Global
53
53
- Product
@@ -105,7 +105,7 @@ Because the `<base>` tag appears above the `<find-and-replace>` tag, Azure API M
105
105
106
106
## Commonly used policies
107
107
108
-
Let's examine some things you can do with policies in API Management. We'll introduce some of the most commonly used policies, and you can visit the API Management documentation for a complete list and examples.
108
+
Let's examine some things you can do with policies in API Management. Here, we introduce you to some of the most commonly used policies, and you can visit the API Management documentation for a complete list and examples.
109
109
110
110
111
111
### Policies for restricting access
@@ -124,7 +124,7 @@ To allow or deny calls from specific IP addresses or ranges of IP addresses, use
124
124
125
125
Several policies enable you to control authentication. For example:
126
126
127
-
Use the **Authenticate with Basic** policy to enable authentication in plain text. This form of authentication is broadly supported, but remember that you should protect it with SSL encryption. Otherwise, a malicious attack can intercept the credentials as they cross the network.
127
+
Use the **Authenticate with Basic** policy to enable authentication in plain text. This form of authentication is broadly supported, but remember that you should protect it with Transport Layer Security (TLS) encryption. Otherwise, a malicious attack can intercept the credentials as they cross the network.
128
128
129
129
Use the **Authenticate with client certificate** policy to enable clients to authenticate by supplying a client certificate.
130
130
@@ -134,7 +134,7 @@ Cross-domain requests are considered a security threat and denied by browsers an
134
134
135
135
Use the **Allow cross-domain calls** policy to permit calls from Adobe Flash and Silverlight. If your API or client apps rely on Cross-Origin Resource Sharing (CORS), use the **CORS** policy to permit them.
136
136
137
-
Some AJAX code, which runs on the browser, uses JSON with padding to make cross-domain calls securely. Use the **JSONP** policy to permit clients to use this technique.
137
+
Some Asynchronous JavaScript and XML (AJAX) code, which runs on the browser, uses JSON with padding to make cross-domain calls securely. Use the **JSONP** policy to permit clients to use this technique.
138
138
139
139
### Transformation policies
140
140
@@ -144,13 +144,13 @@ To convert to and from JSON and XML, use the **Convert JSON to XML** and **Conve
144
144
145
145
Sometimes you want to keep a response in XML, but alter its schema. In such cases, use the **Transform XML** policy to apply an XSLT template.
146
146
147
-
Use **Find and replace string in body** to execute a string substitution. For example, if a brand name changes, you could use this policy to ensure that the change is reflected in all responses, even if the underlying data still includes references to the old name.
147
+
Use **Find and replace string in body** to execute a string substitution. For example, if a brand name changes, you could use this policy to ensure that the change is reflected in all responses. Even if the underlying data still includes references to the old name.
148
148
149
-
The **Mask URLs in content** policy can rewrite any links in the response body so that they point to a different location. This policy is useful when a website or web API has moved.
149
+
The **Mask URLs in content** policy can rewrite any links in the response body so that they point to a different location. This policy is useful when a website or web API moves.
150
150
151
151
Use the **Set body** policy to set the message text for incoming and outgoing requests.
152
152
153
-
If you want to modify an incoming HTTP request or outgoing response, you can use several different policies. To add items to an existing response or request header, use the **Set HTTP header** policy. If you need to modify the query strings, which appear after the question mark in the URL, use the **Set query string parameter** policy. If a public URL, which a user has requested, must be mapped to a different internal destination, the **Rewrite URL** policy can perform the conversion both inbound and outbound.
153
+
If you want to modify an incoming HTTP request or outgoing response, you can use several different policies. To add items to an existing response or request header, use the **Set HTTP header** policy. If you need to modify the query strings, which appear after the question mark in the URL, use the **Set query string parameter** policy. If a user requests a public URL that must be mapped to a different internal destination, the **Rewrite URL** policy can perform the conversion both inbound and outbound.
154
154
155
155
### Advanced policies
156
156
@@ -160,7 +160,7 @@ For example, if you want to apply a policy only when the response passes a speci
160
160
161
161
Use the **Forward request** policy to forward a request to a backend server.
162
162
163
-
To control what happens when an action fails, use the **Retry** policy. Policy statements enclosed in **Retry** will execute repeatedly until a condition is met. Execution repeats at the specified time intervals up until the retry count value is reached.
163
+
To control what happens when an action fails, use the **Retry** policy. Policy statements that are enclosed in **Retry**, execute repeatedly until a condition is met. Execution repeats at the specified time intervals up until the retry count value is reached.
164
164
165
165
The **Send one-way request** policy can send a request to a URL without waiting for a response.
Copy file name to clipboardExpand all lines: learn-pr/azure/improve-api-performance-with-apim-caching-policy/includes/4-configure-a-caching-policy.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@ Optimal API performance is essential to most organizations. By using a cache of
2
2
3
3
Suppose there's a need for the board gaming API to provide faster responses to requests. For example, users often request prices for various sizes of the board for games. API Management policies can accelerate responses by configuring a cache of prepared responses. When a request is received from a user, API Management checks to see if there's an appropriate response in the cache already. If there is, that response can be sent to the user without building it again from the data source.
4
4
5
-
Here, you'll learn how to configure such a cache.
5
+
Here, you learn how to configure such a cache.
6
6
7
7
## How to control the API Management cache
8
8
9
-
To set up a cache, you use an outbound policy named `cache-store` to store responses. You also use an inbound policy named `cache-lookup` to check if there's a cached response for the current request. You can see these two policies in the example below:
9
+
To set up a cache, you use an outbound policy named `cache-store` to store responses. You also use an inbound policy named `cache-lookup` to check if there's a cached response for the current request. You can see these two policies in the following example:
10
10
11
11
```xml
12
12
<policies>
@@ -60,7 +60,7 @@ It's important to ensure that, if you serve a response from the cache, it's rele
This request is intended to check the stock levels for a product with part number 3416. The customer ID is used by a separate policy, and doesn't alter the response. Subsequent requests for the same part number can be served from the cache, as long as the record hasn't expired. So far, so good.
63
+
This request is intended to check the stock levels for a product with part number 3416. The customer ID is used by a separate policy, and doesn't alter the response. Subsequent requests for the same part number can be served from the cache, as long as the record doesn't expire. So far, so good.
64
64
65
65
Now suppose that a different customer requests the same product:
66
66
@@ -93,7 +93,7 @@ To modify this default behavior, use the `vary-by-query-parameter` element withi
93
93
</policies>
94
94
```
95
95
96
-
With this policy, the cache will store and separate responses for each product, because they have different part numbers. The cache won't store separate responses for each *customer*, because that query parameter isn't listed.
96
+
With this policy, the cache stores and separates responses for each product, because they have different part numbers. The cache doesn't store separate responses for each *customer*, because that query parameter isn't listed.
97
97
98
98
By default, Azure API Management doesn't examine HTTP headers to determine whether a cached response is suitable for a given request. If a header can make a significant difference to a response, use the `<vary-by-header>` tag. Work with your developer team to understand how each API uses query parameters and headers so you can decide which vary-by tags to use in your policy.
0 commit comments