Compartir a través de


Workspace Api Operation Policy - List By Operation

Obtenga la lista de configuración de directivas en el nivel de operación de API.

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

Parámetros de identificador URI

Nombre En Requerido Tipo Description
apiId
path True

string

minLength: 1
maxLength: 256
pattern: ^[^*#&+:<>?]+$

Identificador de revisión de API. Debe ser único en la instancia actual del servicio API Management. La revisión no actual tiene ; rev=n como sufijo donde n es el número de revisión.

operationId
path True

string

minLength: 1
maxLength: 80

Identificador de operación dentro de una API. Debe ser único en la instancia actual del servicio API Management.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Nombre del grupo de recursos. El nombre no distingue mayúsculas de minúsculas.

serviceName
path True

string

minLength: 1
maxLength: 50
pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

Nombre del servicio API Management.

subscriptionId
path True

string (uuid)

Identificador de la suscripción de destino. El valor debe ser un UUID.

workspaceId
path True

string

minLength: 1
maxLength: 80
pattern: ^[^*#&+:<>?]+$

Identificador del área de trabajo. Debe ser único en la instancia actual del servicio API Management.

api-version
query True

string

minLength: 1

Versión de la API que se va a usar para esta operación.

Respuestas

Nombre Tipo Description
200 OK

PolicyCollection

Colección de directivas de operaciones de API.

Other Status Codes

ErrorResponse

Respuesta de error que describe por qué se produjo un error en la operación.

Seguridad

azure_auth

Flujo de OAuth2 de Azure Active Directory.

Tipo: oauth2
Flujo: implicit
Dirección URL de autorización: https://login.microsoftonline.com/common/oauth2/authorize

Ámbitos

Nombre Description
user_impersonation suplantar la cuenta de usuario

Ejemplos

ApiManagementListWorkspaceApiOperationPolicies

Solicitud de ejemplo

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies?api-version=2024-05-01

Respuesta de muestra

{
  "value": [
    {
      "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies/policy",
      "type": "Microsoft.ApiManagement/service/workspaces/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": ""
}

Definiciones

Nombre Description
ErrorAdditionalInfo

Información adicional sobre el error de administración de recursos.

ErrorDetail

Detalle del error.

ErrorResponse

Respuesta de error

PolicyCollection

Respuesta de la operación de directiva de lista.

PolicyContentFormat

Formato de policyContent.

PolicyContract

Detalles del contrato de directiva.

ErrorAdditionalInfo

Información adicional sobre el error de administración de recursos.

Nombre Tipo Description
info

object

Información adicional.

type

string

Tipo de información adicional.

ErrorDetail

Detalle del error.

Nombre Tipo Description
additionalInfo

ErrorAdditionalInfo[]

Información adicional del error.

code

string

Código de error.

details

ErrorDetail[]

Detalles del error.

message

string

Mensaje de error.

target

string

Destino del error.

ErrorResponse

Respuesta de error

Nombre Tipo Description
error

ErrorDetail

Objeto de error.

PolicyCollection

Respuesta de la operación de directiva de lista.

Nombre Tipo Description
count

integer (int64)

Número total de recuento de registros.

nextLink

string

Vínculo de página siguiente si existe.

value

PolicyContract[]

Valor del contrato de directiva.

PolicyContentFormat

Formato de policyContent.

Valor Description
xml

El contenido está insertado y el tipo de contenido es un documento XML.

xml-link

El documento XML de directiva se hospeda en un punto de conexión HTTP accesible desde el servicio API Management.

rawxml

El contenido está insertado y el tipo de contenido es un documento de directiva no codificado xml.

rawxml-link

El documento de directiva no está codificado en XML y se hospeda en un punto de conexión HTTP accesible desde el servicio API Management.

PolicyContract

Detalles del contrato de directiva.

Nombre Tipo Valor predeterminado Description
id

string

Identificador de recurso completo para el recurso. Por ejemplo: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Nombre del recurso

properties.format

PolicyContentFormat

xml

Formato de policyContent.

properties.value

string

Contenido de la directiva tal como se define con el formato .

type

string

Tipo del recurso. Por ejemplo, "Microsoft.Compute/virtualMachines" o "Microsoft.Storage/storageAccounts"