我尝试了下面的选项,但它没有获取分配给 api 或操作的有效策略,因为它只获取单独分配给它们的策略
curl --location 'https://management.azure.com/subscriptions/xxxxxxxxxxxx/resourceGroups/xxxxxxxxx/providers/Microsoft.ApiManagement/service/xxxxxxxxxx/apis/apiname/policies/policy?format=xml&api-version=2022-08-01' --header 'Content-Type: application/json' --header 'Authorization: Bearer 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
您可以通过以下网址查看API级别的有效政策。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/policy?effective=true&format=xml&api-version=2022-08-01
CURL 请求-
curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0e************" "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/policies/policy?effective=true&format=xml&api-version=2022-08-01"
我收到的回复如下-
要获取操作级别的有效政策,您可以使用以下网址。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/policy?effective=true&format=xml&api-version=2022-08-01
CURL 请求-
curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eX******" "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/{apiId}/operations/{operationId}/policies/policy?effective=true&format=xml&api-version=2022-08-01"
回应-