Skip to content

Commit 33f637d

Browse files
committed
edit
1 parent 9971f8a commit 33f637d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

articles/api-management/rewrite-uri-policy.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ You can only add query string parameters by using the policy. You can't add extr
4848

4949
### Example 1: Basic URL rewrite
5050

51-
In the following example, the public URL is rewritten to match the backend service URL format.
51+
In the following example, the public URL is rewritten to match the backend service URL format, and query parameters are included based on other logic.
5252

5353
- Public URL - `http://api.example.com/storenumber/ordernumber`
5454

55-
- Request URL - `http://api.example.com/v2/US/hardware/storenumber&ordernumber?City&State`
55+
- Request URL - `http://api.example.com/v2/US/hardware/storenumber/ordernumber?City&State`
5656

5757
```xml
5858
<policies>
5959
<inbound>
6060
<base />
61-
<rewrite-uri template="/v2/US/hardware/{storenumber}&{ordernumber}?City=city&State=state" />
61+
<rewrite-uri template="/v2/US/hardware/{storenumber}/{ordernumber}?City=city&State=state" />
6262
</inbound>
6363
<outbound>
6464
<base />
@@ -104,11 +104,12 @@ In the following example, the public URL is rewritten to match the backend servi
104104

105105
### Example 4: Use policy expression in the template
106106

107-
In the following example, the policy uses an expression to insert an API version into the rewritten URL.
107+
In the following example, the policy uses expressions in the template to construct the request to the backend.
108108

109109
```xml
110110
<policies>
111111
<inbound>
112+
<base />
112113
<set-variable name="apiVersion" value="/v3" />
113114
<rewrite-uri template="@("/api" + context.Variables["apiVersion"] + context.Request.Url.Path)" />
114115
</inbound>

0 commit comments

Comments
 (0)