查询订阅配额

Query quota for subscription

有没有办法在 Azure api 管理中查询基于订阅的使用配额策略的剩余或已用调用?

我看到 https://docs.microsoft.com/en-us/rest/api/apimanagement/quotabycounterkeys/listbyservice but I don't see how to get remaining or used calls for https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#SetUsageQuotaBySubscription 因为我不知道 quotaCounterKey

使用什么

目前无法获取剩余的调用

但您可以使用 https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#SetUsageQuota

设置配额

然后使用quotaCounterKey

Quota counter key identifier.This is the result of expression defined in counter-key attribute of the quota-by-key policy.For Example, if you specify counter-key="boo" in the policy, then it’s accessible by "boo" counter key. But if it’s defined as counter-key="@("b"+"a")" then it will be accessible by "ba" key

以确定一段时间内的当前值。然后从你配置的内容中减去。

反键可以设置为context.SubscriptionId。