你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Api Operation Policy - List By Operation

获取 API 操作级别的策略配置列表。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies?api-version=2021-08-01

URI 参数

名称 必需 类型 说明
apiId
path True

string

API 修订标识符。 在当前API 管理服务实例中必须是唯一的。 非当前修订版具有 ;rev=n 作为后缀,其中 n 是修订号。

正则表达式模式: ^[^*#&+:<>?]+$

operationId
path True

string

API 中的操作标识符。 在当前API 管理服务实例中必须是唯一的。

resourceGroupName
path True

string

资源组的名称。

serviceName
path True

string

API 管理服务的名称。

正则表达式模式: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

唯一标识 Microsoft Azure 订阅的订阅凭据。 此订阅 ID 是每个服务调用的 URI 的一部分。

api-version
query True

string

要与客户端请求一起使用的 API 的版本。

响应

名称 类型 说明
200 OK

PolicyCollection

Api 操作策略集合。

Other Status Codes

ErrorResponse

描述操作失败原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

ApiManagementListApiOperationPolicies

示例请求

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies?api-version=2021-08-01

示例响应

{
  "value": [
    {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies/policy",
      "type": "Microsoft.ApiManagement/service/apis/operations/policies",
      "name": "policy",
      "properties": {
        "value": "<!--\r\n    IMPORTANT:\r\n    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r\n    - Only the <forward-request> policy element can appear within the <backend> section element.\r\n    - To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.\r\n    - To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.\r\n    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r\n    - To remove a policy, delete the corresponding policy statement from the policy document.\r\n    - Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope.\r\n    - Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope.\r\n    - Policies are applied in the order of their appearance, from the top down.\r\n-->\r\n<policies>\r\n  <inbound>\r\n    <validate-jwt header-name=\"dd\">\r\n      <required-claims>\r\n        <claim name=\"bla\" separator=\"\">\r\n          <value>xxx</value>\r\n        </claim>\r\n      </required-claims>\r\n    </validate-jwt>\r\n    <base />\r\n  </inbound>\r\n  <backend>\r\n    <base />\r\n  </backend>\r\n  <outbound>\r\n    <base />\r\n  </outbound>\r\n</policies>"
      }
    }
  ],
  "count": 1,
  "nextLink": ""
}

定义

名称 说明
ErrorFieldContract

错误字段协定。

ErrorResponse

错误响应。

PolicyCollection

列表策略操作的响应。

PolicyContentFormat

policyContent 的格式。

PolicyContract

策略协定详细信息。

ErrorFieldContract

错误字段协定。

名称 类型 说明
code

string

属性级错误代码。

message

string

属性级错误的可读表示形式。

target

string

属性名称。

ErrorResponse

错误响应。

名称 类型 说明
error.code

string

服务定义的错误代码。 此代码用作响应中指定的 HTTP 错误代码的子状态。

error.details

ErrorFieldContract[]

在发生验证错误时,请求中发送的无效字段列表。

error.message

string

错误的用户可读表示形式。

PolicyCollection

列表策略操作的响应。

名称 类型 说明
count

integer

总记录计数数。

nextLink

string

下一页链接(如果有)。

value

PolicyContract[]

策略协定值。

PolicyContentFormat

policyContent 的格式。

名称 类型 说明
rawxml

string

内容是内联的,内容类型是非 XML 编码的策略文档。

rawxml-link

string

策略文档未进行 Xml 编码,托管在可从 API 管理 服务访问的 http 终结点上。

xml

string

内容是内联的,内容类型是 XML 文档。

xml-link

string

策略 XML 文档托管在可从 API 管理 服务访问的 http 终结点上。

PolicyContract

策略协定详细信息。

名称 类型 默认值 说明
id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.format

PolicyContentFormat

xml

policyContent 的格式。

properties.value

string

格式定义的策略的内容。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”