{tocify} $title={Table of Contents}
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>
The 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>