Delen via


Api Policy - Get

Haal de beleidsconfiguratie op API-niveau op.

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

URI-parameters

Name In Vereist Type Description
apiId
path True

string

API-revisie-id. Moet uniek zijn in het huidige API Management service-exemplaar. Niet-huidige revisie heeft ; rev=n als een achtervoegsel waarbij n het revisienummer is.

Regex-patroon: ^[^*#&+:<>?]+$

policyId
path True

PolicyIdName

De id van het beleid.

resourceGroupName
path True

string

De naam van de resourcegroep.

serviceName
path True

string

De naam van de API Management service.

Regex-patroon: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

Abonnementsreferenties waarmee het Microsoft Azure-abonnement uniek wordt geïdentificeerd. De abonnements-id maakt deel uit van de URI voor elke service-aanroep.

api-version
query True

string

Versie van de API die moet worden gebruikt met de clientaanvraag.

format
query

PolicyExportFormat

Beleidsexportindeling.

Antwoorden

Name Type Description
200 OK

PolicyContract

Informatie over API-beleid.

Media Types: "application/json", "application/vnd.ms-azure-apim.policy+xml", "application/vnd.ms-azure-apim.policy.raw+xml"

Kopteksten

ETag: string

Other Status Codes

ErrorResponse

Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.

Media Types: "application/json", "application/vnd.ms-azure-apim.policy+xml", "application/vnd.ms-azure-apim.policy.raw+xml"

Beveiliging

azure_auth

Azure Active Directory OAuth2-stroom.

Type: oauth2
Stroom: implicit
Autorisatie-URL: https://login.microsoftonline.com/common/oauth2/authorize

Bereiken

Name Description
user_impersonation uw gebruikersaccount imiteren

Voorbeelden

ApiManagementGetApiPolicy

Voorbeeldaanvraag

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b59475ff190048040001/policies/policy?api-version=2021-08-01

Voorbeeldrespons

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/5600b59475ff190048040001/policies/policy",
  "type": "Microsoft.ApiManagement/service/apis/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    <quota-by-key calls=\"5\" bandwidth=\"2\" renewal-period=\"&#x9;P3Y6M4DT12H30M5S\" counter-key=\"ba\" />\r\n    <base />\r\n  </inbound>\r\n  <backend>\r\n    <base />\r\n  </backend>\r\n  <outbound>\r\n    <log-to-eventhub logger-id=\"apimService1\" partition-key=\"@(context.Subscription.Id)\">\r\n@{\r\n\tRandom Random = new Random();\r\n\t\t\t\tconst string Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \";                \r\n                return string.Join(\",\", DateTime.UtcNow, new string(\r\n                    Enumerable.Repeat(Chars, Random.Next(2150400))\r\n                              .Select(s =&gt; s[Random.Next(s.Length)])\r\n                              .ToArray()));\r\n          }                           \r\n                        </log-to-eventhub>\r\n    <base />\r\n  </outbound>\r\n</policies>"
  }
}

Definities

Name Description
ErrorFieldContract

Fout Veldcontract.

ErrorResponse

Foutreactie.

PolicyContentFormat

Indeling van de policyContent.

PolicyContract

Details van het beleidscontract.

PolicyExportFormat

Beleidsexportindeling.

PolicyIdName

De id van het beleid.

ErrorFieldContract

Fout Veldcontract.

Name Type Description
code

string

Foutcode op eigenschapsniveau.

message

string

Door mensen leesbare weergave van fout op eigenschapsniveau.

target

string

Naam van eigenschap.

ErrorResponse

Foutreactie.

Name Type Description
error.code

string

Door de service gedefinieerde foutcode. Deze code fungeert als een substatus voor de HTTP-foutcode die is opgegeven in het antwoord.

error.details

ErrorFieldContract[]

De lijst met ongeldige velden verzenden in aanvraag, in het geval van een validatiefout.

error.message

string

Door mensen leesbare weergave van de fout.

PolicyContentFormat

Indeling van de policyContent.

Name Type Description
rawxml

string

De inhoud is inline en Inhoudstype is een niet-XML-gecodeerd beleidsdocument.

rawxml-link

string

Het beleidsdocument is niet met XML gecodeerd en wordt gehost op een HTTP-eindpunt dat toegankelijk is vanuit de API Management-service.

xml

string

De inhoud is inline en inhoudstype is een XML-document.

xml-link

string

Het XML-beleidsdocument wordt gehost op een HTTP-eindpunt dat toegankelijk is vanuit de API Management-service.

PolicyContract

Details van het beleidscontract.

Name Type Default value Description
id

string

Volledig gekwalificeerde resource-id voor de resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

De naam van de resource

properties.format

PolicyContentFormat

xml

Indeling van de policyContent.

properties.value

string

Inhoud van het beleid zoals gedefinieerd door de indeling.

type

string

Het type resource. Bijvoorbeeld 'Microsoft.Compute/virtualMachines' of 'Microsoft.Storage/storageAccounts'

PolicyExportFormat

Beleidsexportindeling.

Name Type Description
rawxml

string

De inhoud is inline en Inhoudstype is een niet-XML-gecodeerd beleidsdocument.

xml

string

De inhoud is inline en inhoudstype is een XML-document.

PolicyIdName

De id van het beleid.

Name Type Description
policy

string