I am trying to create a policy in APIM which fetches the product for the subscription-key passed in the header. I need to get that product name and do set-header
with that name for the backend service. Is it possible to achieve it through APIM Policies ?
0
votes
1 Answers
0
votes
First, we added two more subscription scopes: all APIs and a single API. The scope of subscriptions is no longer limited to an API product. It's now possible to create keys that grant access to an API, or all APIs within an API Management instance, without needing to create a product and add the APIs to it first. Also, each API Management instance now comes with an immutable, all-APIs subscription. This subscription makes it easier and more straightforward to test and debug APIs within the test console.
You can get the Product Name with @(context.Product.Name)
.
<inbound>
<base />
<set-variable name="aaa" value="@(context.Product.Name)" />
<set-body template="liquid">
{
"success": true,
"var1": {{context.Variables["aaa"]}}
}
</set-body>
</inbound>
In test, set the product name as Starter
and you will get the snapshot as below.