Here a short dump how to use requestbin (https://requestbin.com/) for API Management policy testing.
Navigate to
requestbin (https://requestbin.com/)
Create a
Request Bin
Get a new
endpoint
Press „Generate
Test Events“ to learn how to record and inspect incoming requests
Click a request
in the left pane (live incoming requests sequence) and inspect request content
(headers, body) in the right pane
Copy and
store the endpoint URL for use as backend URL in Azure API Management
Open Azure
portal and login to your account [or create new one – https://azure.microsoft.com/en-us/free/]
Navigate to
your API Management instance
Navigate to
APIs
Add new blank API
Enter data
for new blank API (set Web service URL to URL copied from requestbin as
described above)
Create new API
operation
Set
operation parameters as required (here we use POST sample)
Save the
operation and return to API design pane
Switch to „Test“
pane, enter test data (headers, body) for test request, press “Send”
Inspect response
in Test pane
Inspect „Trace“ records
Switch to
requestbin and inspect incoming request
Back to API
portal, start policy editor
Enter
policy to test, for example
<policies>
<inbound>
<base
/>
<set-body>@(context.Request.Body.As<String>().ToUpper())</set-body>
</inbound>
<backend>
<base
/>
</backend>
<outbound>
<base
/>
</outbound>
<on-error>
<base
/>
</on-error>
</policies>
Be aware to enter policy on the right place (selected operation, all
operations etc.), save it finally
Return to
Test pane, enter test request data, send the request
Inspect
response data in Test pane
Inspect Trace
records (specially, details about how the policy was applied)
Requestbin
console lists this request as
And the
contents are [uppercased due to applied sample policy]
Enjoy!