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
description: In this unit, you will answer questions based on a scenario.
7
-
ms.date: 07/12/2023
8
-
author: dlepow
9
-
ms.author: danlep
10
-
ms.topic: unit
11
-
durationInMinutes: 5
12
-
content: |
13
-
[!include[](includes/3-knowledge-check.md)]
14
-
quiz:
15
-
title: Knowledge check
16
-
questions:
17
-
- content: "Which policy would you use to ensure that the Board Pricing API sends all its responses in XML format?"
18
-
choices:
19
-
- content: "JSONP"
20
-
isCorrect: false
21
-
explanation: "This policy permits JSON with padding, which is a cross-domain request technique and has nothing to do with XML. To ensure XML output, use Convert JSON to XML."
22
-
- content: "Convert JSON to XML"
23
-
isCorrect: true
24
-
explanation: "This policy recodes any response in JSON format as XML text."
25
-
- content: "Find and replace string in body"
26
-
isCorrect: false
27
-
explanation: "This policy finds a specified string and replaces it with another. To ensure XML output, use Convert JSON to XML."
28
-
- content: 'Where would you configure your policy to ensure XML responses?'
29
-
choices:
30
-
- content: "Inbound"
31
-
isCorrect: false
32
-
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they are sent to users."
33
-
- content: "Outbound"
34
-
isCorrect: true
35
-
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they are sent to users."
36
-
- content: "On-error"
37
-
isCorrect: false
38
-
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they are sent to users."
39
-
- content: "What scope would you use for the policy that ensures XML responses?"
40
-
choices:
41
-
- content: "Global scope for the API Management instance"
42
-
isCorrect: false
43
-
explanation: "Do not use the `<json-to-xml>` policy with global scope, because this change would force all responses from the Sales API to use XML, but the website expects JSON responses."
44
-
- content: "Product scope for the Sales product"
45
-
isCorrect: false
46
-
explanation: "Do not use the `<json-to-xml>` policy with product scope, because this change would force all responses from the Sales API to use XML, but the website expects JSON responses. Also, this scope does not apply to the Board Pricing API, which is not part of the Sales product."
47
-
- content: "API scope for the Board Pricing API"
48
-
isCorrect: true
49
-
explanation: "Use the `<json-to-xml>` policy with API scope for the Board Pricing API to ensure that all responses are sent in XML, even if developers coded them to return JSON."
description: In this unit, you answer questions based on a scenario.
7
+
ms.date: 07/12/2023
8
+
author: dlepow
9
+
ms.author: danlep
10
+
ms.topic: unit
11
+
durationInMinutes: 5
12
+
content: |
13
+
[!include[](includes/3-knowledge-check.md)]
14
+
quiz:
15
+
title: Knowledge check
16
+
questions:
17
+
- content: "Which policy would you use to ensure that the Board Pricing API sends all its responses in XML format?"
18
+
choices:
19
+
- content: "JSONP"
20
+
isCorrect: false
21
+
explanation: "This policy permits JSON with padding, which is a cross-domain request technique and has nothing to do with XML. To ensure XML output, use Convert JSON to XML."
22
+
- content: "Convert JSON to XML"
23
+
isCorrect: true
24
+
explanation: "This policy recodes any response in JSON format as XML text."
25
+
- content: "Find and replace string in body"
26
+
isCorrect: false
27
+
explanation: "This policy finds a specified string and replaces it with another. To ensure XML output, use Convert JSON to XML."
28
+
- content: 'Where would you configure your policy to ensure XML responses?'
29
+
choices:
30
+
- content: "Inbound"
31
+
isCorrect: false
32
+
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they're sent to users."
33
+
- content: "Outbound"
34
+
isCorrect: true
35
+
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they're sent to users."
36
+
- content: "On-error"
37
+
isCorrect: false
38
+
explanation: "Set this policy in the Outbound tag, because you want to modify responses as they're sent to users."
39
+
- content: "What scope would you use for the policy that ensures XML responses?"
40
+
choices:
41
+
- content: "Global scope for the API Management instance"
42
+
isCorrect: false
43
+
explanation: "Don't use the `<json-to-xml>` policy with global scope, because this change would force all responses from the Sales API to use XML, but the website expects JSON responses."
44
+
- content: "Product scope for the Sales product"
45
+
isCorrect: false
46
+
explanation: "Don't use the `<json-to-xml>` policy with product scope, because this change would force all responses from the Sales API to use XML, but the website expects JSON responses. Also, this scope doesn't apply to the Board Pricing API, which isn't part of the Sales product."
47
+
- content: "API scope for the Board Pricing API"
48
+
isCorrect: true
49
+
explanation: "Use the `<json-to-xml>` policy with API scope for the Board Pricing API to ensure that all responses are sent in XML, even if developers coded them to return JSON."
Copy file name to clipboardExpand all lines: learn-pr/azure/improve-api-performance-with-apim-caching-policy/includes/1-introduction.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
Many organizations use APIs to publish data and services. Customers and partners can call these APIs from a client: desktop applications, mobile apps, web apps, and other systems. If your API is popular, you may need to optimize its performance to guarantee service to users.
1
+
Many organizations use APIs to publish data and services. Customers and partners can call these APIs from a client: desktop applications, mobile apps, web apps, and other systems. If your API is popular, you might need to optimize its performance to guarantee service to users.
2
2
3
-
Suppose you're a developer for a board game company. A product line your company produces has recently become popular. The volume of requests from your retail partners to your inventory API is growing quickly - much faster than the rate your inventory changes. You'd like your API to respond to requests rapidly without incurring load on your API.
3
+
Suppose you're a developer for a board game company. A product line your company produces has recently become popular. The volume of requests from your retail partners to your inventory API is growing quickly - more quickly than the rate your inventory changes. You'd like your API to respond to requests rapidly without incurring load on your API.
4
4
5
-
You use Azure API Management to host your API. You're considering using an API Management policy to cache compiled responses to requests. You think that this technique will be a way to optimize performance. You want to learn how to write API Management policies and how to use them to set up and control a cache. Then you want to write policies that accelerate responses to users.
5
+
You use Azure API Management to host your API. You're considering using an API Management policy to cache compiled responses to requests. You think that this technique could be a way to optimize performance. You want to learn how to write API Management policies and how to use them to set up and control a cache. Then you want to write policies that accelerate responses to users.
6
6
7
7
## Learning objectives
8
8
9
9
In this module, you'll:
10
10
11
-
- Identify whether or not a policy exists for the desired behavior
12
-
- Choose a policy scope
13
-
- Configure and apply a caching policy in the Azure portal
11
+
- Identify whether or not a policy exists for the desired behavior.
12
+
- Choose a policy scope.
13
+
- Configure and apply a caching policy in the Azure portal.
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
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ 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'll 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. 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.
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 will be applied. The following are policy scopes from which you can choose:
50
+
A policy's scope determines how broadly it's applied. The following are policy scopes from which you can choose:
51
51
52
52
- Global
53
53
- Product
@@ -84,7 +84,7 @@ Policies applied at the API scope affect only a single API. To set a policy at t
84
84
85
85
### Operation
86
86
87
-
Policies applied at the operation scope affect only one operation within the API. In the example below, the administrator has selected the **GetSpeaker** operation within the **Demo Conference API** and can set inbound, outbound, or backend policies that apply only to that operation:
87
+
Policies applied at the operation scope affect only one operation within the API. In the following example, the administrator selects the **GetSpeaker** operation within the **Demo Conference API** and can set inbound, outbound, or backend policies that apply only to that operation:
88
88
89
89
:::image type="content" source="../media/2-operation-scope.png" alt-text="Screenshot of the operation scope in the portal.":::
90
90
@@ -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 SSL 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
@@ -144,7 +144,7 @@ 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 has changed, 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
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.
150
150
@@ -154,13 +154,13 @@ If you want to modify an incoming HTTP request or outgoing response, you can use
154
154
155
155
### Advanced policies
156
156
157
-
These policies can be of use in scenarios when you want non-standard behavior.
157
+
These policies can be of use in scenarios when you want nonstandard behavior.
158
158
159
159
For example, if you want to apply a policy only when the response passes a specific test, use the **Control flow** policy.
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 will repeat 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 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.
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/3-knowledge-check.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,6 @@ You're planning API Management policies for your board games company. You have t
4
4
-**The Stock Management API**: Your staff uses a mobile app that calls this API to determine the stock level of your company's games.
5
5
-**The Sales API**: The website uses this API to place orders from customers for your company's games.
6
6
7
-
You've added the Stock Management API and the Sales API to an API Management product named **Sales**.
7
+
You added the Stock Management API and the Sales API to an API Management product named **Sales**.
8
8
9
-
For the Board Pricing API, you want to make sure that all responses are sent in XML, even though developers have written some operations to generate JSON text. The mobile app expects responses in XML, and the website expects responses in JSON.
9
+
For the Board Pricing API, you want to make sure that all responses are sent in XML, even though developers wrote some operations to generate JSON text. The mobile app expects responses in XML, and the website expects responses in JSON.
0 commit comments