Workspace Policy - Get
Obtenez la configuration de la stratégie au niveau de l’API.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/policy?api-version=2024-05-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/policy?format={format}&api-version=2024-05-01
Paramètres URI
| Nom | Dans | Obligatoire | Type | Description |
|---|---|---|---|---|
|
policy
|
path | True |
Identificateur de la stratégie. |
|
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
Nom du groupe de ressources. Le nom ne respecte pas la casse. |
|
service
|
path | True |
string minLength: 1maxLength: 50 pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$ |
Nom du service Gestion des API. |
|
subscription
|
path | True |
string (uuid) |
ID de l’abonnement cible. La valeur doit être un UUID. |
|
workspace
|
path | True |
string minLength: 1maxLength: 80 pattern: ^[^*#&+:<>?]+$ |
Identificateur de l’espace de travail. Doit être unique dans l’instance actuelle du service Gestion des API. |
|
api-version
|
query | True |
string minLength: 1 |
Version de l’API à utiliser pour cette opération. |
|
format
|
query |
Format d’exportation de stratégie. |
Réponses
| Nom | Type | Description |
|---|---|---|
| 200 OK |
Informations sur la stratégie d’espace de travail. En-têtes ETag: string |
|
| Other Status Codes |
Réponse d’erreur décrivant pourquoi l’opération a échoué. |
Sécurité
azure_auth
Flux OAuth2 Azure Active Directory.
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
| Nom | Description |
|---|---|
| user_impersonation | emprunter l’identité de votre compte d’utilisateur |
Exemples
ApiManagementGetWorkspacePolicy
Exemple de requête
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy?api-version=2024-05-01
Exemple de réponse
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy",
"type": "Microsoft.ApiManagement/service/workspaces/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=\"	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 => s[Random.Next(s.Length)])\r\n .ToArray()));\r\n } \r\n </log-to-eventhub>\r\n <base />\r\n </outbound>\r\n</policies>"
}
}
Définitions
| Nom | Description |
|---|---|
|
Error |
Informations supplémentaires sur l’erreur de gestion des ressources. |
|
Error |
Détail de l’erreur. |
|
Error |
Réponse d’erreur |
|
Policy |
Format de policyContent. |
|
Policy |
Détails du contrat de stratégie. |
|
Policy |
Format d’exportation de stratégie. |
|
Policy |
Identificateur de la stratégie. |
ErrorAdditionalInfo
Informations supplémentaires sur l’erreur de gestion des ressources.
| Nom | Type | Description |
|---|---|---|
| info |
object |
Informations supplémentaires. |
| type |
string |
Type d’informations supplémentaire. |
ErrorDetail
Détail de l’erreur.
| Nom | Type | Description |
|---|---|---|
| additionalInfo |
Informations supplémentaires sur l’erreur. |
|
| code |
string |
Code d’erreur. |
| details |
Détails de l’erreur. |
|
| message |
string |
Message d’erreur. |
| target |
string |
Cible d’erreur. |
ErrorResponse
Réponse d’erreur
| Nom | Type | Description |
|---|---|---|
| error |
Objet d’erreur. |
PolicyContentFormat
Format de policyContent.
| Valeur | Description |
|---|---|
| xml |
Le contenu est inline et le type de contenu est un document XML. |
| xml-link |
Le document XML de stratégie est hébergé sur un point de terminaison HTTP accessible à partir du service Gestion des API. |
| rawxml |
Le contenu est inline et le type de contenu est un document de stratégie encodé non XML. |
| rawxml-link |
Le document de stratégie n’est pas encodé XML et est hébergé sur un point de terminaison HTTP accessible à partir du service Gestion des API. |
PolicyContract
Détails du contrat de stratégie.
| Nom | Type | Valeur par défaut | Description |
|---|---|---|---|
| id |
string |
ID de ressource complet pour la ressource. ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
|
| name |
string |
Nom de la ressource |
|
| properties.format | xml |
Format de policyContent. |
|
| properties.value |
string |
Contenu de la stratégie tel que défini par le format. |
|
| type |
string |
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts » |
PolicyExportFormat
Format d’exportation de stratégie.
| Valeur | Description |
|---|---|
| xml |
Le contenu est inline et le type de contenu est un document XML. |
| rawxml |
Le contenu est inline et le type de contenu est un document de stratégie encodé non XML. |
PolicyIdName
Identificateur de la stratégie.
| Valeur | Description |
|---|---|
| policy |