Workspace Policy Fragment - Get

Hämtar ett principfragment.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}?api-version=2024-05-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policyFragments/{id}?api-version=2024-05-01&format={format}

URI-parametrar

Name I Obligatorisk Typ Description
id
path True

string

minLength: 1
maxLength: 80
pattern: (^[\w]+$)|(^[\w][\w\-]+[\w]$)

En resursidentifierare.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Namnet på resursgruppen. Namnet är skiftlägesokänsligt.

serviceName
path True

string

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

Namnet på API Management-tjänsten.

subscriptionId
path True

string (uuid)

ID för målprenumerationen. Värdet måste vara ett UUID.

workspaceId
path True

string

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

Arbetsyteidentifierare. Måste vara unikt i den aktuella API Management-tjänstinstansen.

api-version
query True

string

minLength: 1

DEN API-version som ska användas för den här åtgärden.

format
query

PolicyFragmentContentFormat

Innehållsformat för principfragment.

Svar

Name Typ Description
200 OK

PolicyFragmentContract

Ett principfragment returnerades.

Sidhuvuden

ETag: string

Other Status Codes

ErrorResponse

Felsvar som beskriver varför åtgärden misslyckades.

Säkerhet

azure_auth

Azure Active Directory OAuth2-flöde.

Typ: oauth2
Flow: implicit
Auktoriseringswebbadress: https://login.microsoftonline.com/common/oauth2/authorize

Omfattningar

Name Description
user_impersonation personifiera ditt användarkonto

Exempel

ApiManagementGetWorkspacePolicyFragment
ApiManagementGetWorkspacePolicyFragmentFormat

ApiManagementGetWorkspacePolicyFragment

Exempelbegäran

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policyFragments/policyFragment1?api-version=2024-05-01

Exempelsvar

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/workspaces/policyFragments",
  "name": "policyFragment1",
  "properties": {
    "format": "xml",
    "description": "A policy fragment example",
    "value": "<fragment><json-to-xml apply=\"always\" consider-accept-header=\"false\" /></fragment>"
  }
}

ApiManagementGetWorkspacePolicyFragmentFormat

Exempelbegäran

GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policyFragments/policyFragment1?api-version=2024-05-01&format=rawxml

Exempelsvar

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/workspaces/policyFragments",
  "name": "policyFragment1",
  "properties": {
    "format": "rawxml",
    "description": "A policy fragment example",
    "value": "<fragment><set-header name=\"correlationid\" exists-action=\"skip\">\r\n\t\t\t<value>@{\n                var guidBinary = new byte[16];\n                Array.Copy(Guid.NewGuid().ToByteArray(), 0, guidBinary, 0, 10);\n                long time = DateTime.Now.Ticks;\n                byte[] bytes = new byte[6];\n                unchecked\n                {\n                       bytes[5] = (byte)(time >> 40);\n                       bytes[4] = (byte)(time >> 32);\n                       bytes[3] = (byte)(time >> 24);\n                       bytes[2] = (byte)(time >> 16);\n                       bytes[1] = (byte)(time >> 8);\n                       bytes[0] = (byte)(time);\n                }\n                Array.Copy(bytes, 0, guidBinary, 10, 6);\n                return new Guid(guidBinary).ToString();\n            }\n            </value>\r\n\t\t</set-header></fragment>"
  }
}

Definitioner

Name Description
ErrorAdditionalInfo

Ytterligare information om resurshanteringsfelet.

ErrorDetail

Felinformationen.

ErrorResponse

Felsvar

PolicyFragmentContentFormat

Format för innehållet i principfragmentet.

PolicyFragmentContract

Avtalsinformation om principfragment.

ErrorAdditionalInfo

Ytterligare information om resurshanteringsfelet.

Name Typ Description
info

object

Ytterligare information.

type

string

Ytterligare informationstyp.

ErrorDetail

Felinformationen.

Name Typ Description
additionalInfo

ErrorAdditionalInfo[]

Ytterligare information om felet.

code

string

Felkoden.

details

ErrorDetail[]

Felinformationen.

message

string

Felmeddelandet.

target

string

Felmålet.

ErrorResponse

Felsvar

Name Typ Description
error

ErrorDetail

Felobjektet.

PolicyFragmentContentFormat

Format för innehållet i principfragmentet.

Värde Description
xml

Innehållet är infogat och innehållstypen är ett XML-dokument.

rawxml

Innehållet är infogat och Innehållstyp är ett icke XML-kodat principdokument.

PolicyFragmentContract

Avtalsinformation om principfragment.

Name Typ Standardvärde Description
id

string

Fullständigt kvalificerat resurs-ID för resursen. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Namnet på resursen

properties.description

string

minLength: 0
maxLength: 1000

Beskrivning av principfragment.

properties.format

PolicyFragmentContentFormat

xml

Format för innehållet i principfragmentet.

properties.provisioningState

string

Etableringstillståndet

properties.value

string

Innehållet i principfragmentet.

type

string

Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"