APIM : 通过传递的订阅密钥查找组名
APIM : Find the group name by the subscription key passed
我正在尝试在 APIM 中创建一个策略,该策略为 header 中传递的 subscription-key 获取产品。我需要获取该产品名称并使用该名称为后端服务执行 set-header
。是否可以通过 APIM 策略实现?
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.
您可以通过 @(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>
在测试中,将产品名称设置为Starter
,您将得到如下快照。
我正在尝试在 APIM 中创建一个策略,该策略为 header 中传递的 subscription-key 获取产品。我需要获取该产品名称并使用该名称为后端服务执行 set-header
。是否可以通过 APIM 策略实现?
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.
您可以通过 @(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>
在测试中,将产品名称设置为Starter
,您将得到如下快照。