Azure API Management Policy for operation filter at API level policy
Policy at method level using api level policy
Table of contents
No headings in the article.
If you want to apply policy at method level in Azure API Management, we can apply using Azure portal on selecting the method and editing the policy.
But if you want to use API level policy to apply only for some operations (methods) then we can achieve that with when condition.
<choose>
<when condition="@(context.Operation.Name.Equals("myOperationName"))">
-----Your policy here-------
</when>
</choose>
Above policy is used at API level and I use the 'myOperationName' value with the operation for which i need to apply a policy.
We can also apply for multiple operations (methods) with OR condition like below:
<choose>
<when condition="@(context.Operation.Name.Equals("myOperationName") || context.Operation.Name.Equals("myOperation2Name"))">
-----Your policy here-------
</when>
</choose>