Share via


Api Policy - Get

İlke yapılandırmasını API düzeyinde alın.

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

URI Parametreleri

Name İçinde Gerekli Tür Description
apiId
path True

string

API düzeltme tanımlayıcısı. Geçerli API Management hizmet örneğinde benzersiz olmalıdır. Geçerli olmayan düzeltmede ; rev=n sonek olarak, burada n düzeltme numarasıdır.

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

policyId
path True

PolicyIdName

İlkenin tanımlayıcısı.

resourceGroupName
path True

string

Kaynak grubunun adı. Ad büyük/küçük harfe duyarlı değildir.

serviceName
path True

string

API Management hizmetinin adı.

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

subscriptionId
path True

string

Hedef aboneliğin kimliği.

api-version
query True

string

Bu işlem için kullanılacak API sürümü.

format
query

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

Yanıtlar

Name Tür Description
200 OK

PolicyContract

Api İlkesi bilgileri.

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

Headers

ETag: string

Other Status Codes

ErrorResponse

İşlemin neden başarısız olduğunu açıklayan hata yanıtı.

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

Güvenlik

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation kullanıcı hesabınızın kimliğine bürünme

Örnekler

ApiManagementGetApiPolicy

Sample Request

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

Sample Response

{
  "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>"
  }
}

Tanımlar

Name Description
ErrorFieldContract

Hata Alanı sözleşmesi.

ErrorResponse

Hata Yanıtı.

PolicyContentFormat

policyContent biçimi.

PolicyContract

İlke Sözleşmesi ayrıntıları.

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

PolicyIdName

İlkenin tanımlayıcısı.

ErrorFieldContract

Hata Alanı sözleşmesi.

Name Tür Description
code

string

Özellik düzeyi hata kodu.

message

string

Özellik düzeyi hatanın insan tarafından okunabilir gösterimi.

target

string

Özellik adı.

ErrorResponse

Hata Yanıtı.

Name Tür Description
error.code

string

Hizmet tanımlı hata kodu. Bu kod, yanıtta belirtilen HTTP hata kodu için bir alt durum görevi görür.

error.details

ErrorFieldContract[]

Doğrulama hatası durumunda istekte gönderilen geçersiz alanların listesi.

error.message

string

Hatanın insan tarafından okunabilen gösterimi.

PolicyContentFormat

policyContent biçimi.

Name Tür Description
rawxml

string

İçerikler satır içidir ve İçerik türü XML ile kodlanmamış bir ilke belgesidir.

rawxml-link

string

İlke belgesi XML olarak kodlanmaz ve API Management hizmetinden erişilebilen bir HTTP uç noktasında barındırılır.

xml

string

İçerikler satır içidir ve İçerik türü bir XML belgesidir.

xml-link

string

İlke XML belgesi, API Management hizmetinden erişilebilen bir HTTP uç noktasında barındırılır.

PolicyContract

İlke Sözleşmesi ayrıntıları.

Name Tür Varsayılan değer Description
id

string

Kaynağın tam kaynak kimliği. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Kaynağın adı

properties.format

PolicyContentFormat

xml

policyContent biçimi.

properties.value

string

İlkenin biçimiyle tanımlandığı şekilde içeriği.

type

string

Kaynağın türü. Örneğin, "Microsoft.Compute/virtualMachines" veya "Microsoft.Storage/storageAccounts"

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

Name Tür Description
rawxml

string

İçerikler satır içidir ve İçerik türü XML ile kodlanmamış bir ilke belgesidir.

xml

string

İçerikler satır içidir ve İçerik türü bir XML belgesidir.

PolicyIdName

İlkenin tanımlayıcısı.

Name Tür Description
policy

string