swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Use these REST APIs for performing operations on Global Policies in Azure API Management deployment.
  title: ApiManagementClient
  version: 2018-06-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2018-06-01-preview/apimpolicies.json
      version: "2.0"
  x-preferred: false
  x-providerName: azure.com
  x-serviceName: apimanagement-apimpolicies
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow.
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters: {}
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies":
    get:
      description: Lists all the Global Policy definitions of the Api Management service.
      operationId: Policy_ListByService
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: Returns an array of Policy Contracts.
          schema:
            description: The response of the list policy operation.
            properties:
              nextLink:
                description: Next page link if any.
                type: string
              value:
                description: Policy Contract value.
                items:
                  allOf:
                    - description: The Resource definition.
                      properties:
                        id:
                          description: Resource ID.
                          readOnly: true
                          type: string
                        name:
                          description: Resource name.
                          readOnly: true
                          type: string
                        type:
                          description: Resource type for API Management resource.
                          readOnly: true
                          type: string
                      x-ms-azure-resource: true
                  description: Policy Contract details.
                  properties:
                    properties:
                      description: Policy contract Properties.
                      properties:
                        contentFormat:
                          default: xml
                          description: Format of the policyContent.
                          enum:
                            - xml
                            - xml-link
                            - rawxml
                            - rawxml-link
                          type: string
                          x-ms-enum:
                            modelAsString: true
                            name: PolicyContentFormat
                            values:
                              - description: The contents are inline and Content type is an XML document.
                                value: xml
                              - description: The policy XML document is hosted on a http endpoint accessible from the API Management service.
                                value: xml-link
                              - description: The contents are inline and Content type is a non XML encoded policy document.
                                value: rawxml
                              - description: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service.
                                value: rawxml-link
                        policyContent:
                          description: Json escaped Xml Encoded contents of the Policy.
                          type: string
                      required:
                        - policyContent
                type: array
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Policy
      x-ms-examples:
        ApiManagementListPolicies:
          parameters:
            api-version: 2018-06-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200":
              body:
                nextLink: ""
                value:
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy
                    name: policy
                    properties:
                      policyContent: "<!--\r

                        \    IMPORTANT:\r

                        \    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r

                        \    - Only the <forward-request> policy element can appear within the <backend> section element.\r

                        \    - 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

                        \    - 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

                        \    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r

                        \    - To remove a policy, delete the corresponding policy statement from the policy document.\r

                        \    - Policies are applied in the order of their appearance, from the top down.\r

                        -->\r

                        <policies>\r

                        \  <inbound />\r

                        \  <backend>\r

                        \    <forward-request />\r

                        \  </backend>\r

                        \  <outbound />\r

                        </policies>"
                    type: Microsoft.ApiManagement/service/policies
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policies/{policyId}":
    delete:
      description: Deletes the global policy configuration of the Api Management Service.
      operationId: Policy_Delete
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The identifier of the Policy.
          enum:
            - policy
          in: path
          name: policyId
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: PolicyIdName
          x-ms-parameter-location: method
        - description: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.
          in: header
          name: If-Match
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: Policy was successfully removed
        "204":
          description: Policy successfully removed by previous request or does not exist
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Policy
      x-ms-examples:
        ApiManagementDeletePolicy:
          parameters:
            If-Match: "*"
            api-version: 2018-06-01-preview
            policyId: policy
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200": {}
            "204": {}
    get:
      description: Get the Global policy definition of the Api Management service.
      operationId: Policy_Get
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The identifier of the Policy.
          enum:
            - policy
          in: path
          name: policyId
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: PolicyIdName
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: Get the Global policy definition of the Api Management service.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Policy Contract details.
            properties:
              properties:
                description: Policy contract Properties.
                properties:
                  contentFormat:
                    default: xml
                    description: Format of the policyContent.
                    enum:
                      - xml
                      - xml-link
                      - rawxml
                      - rawxml-link
                    type: string
                    x-ms-enum:
                      modelAsString: true
                      name: PolicyContentFormat
                      values:
                        - description: The contents are inline and Content type is an XML document.
                          value: xml
                        - description: The policy XML document is hosted on a http endpoint accessible from the API Management service.
                          value: xml-link
                        - description: The contents are inline and Content type is a non XML encoded policy document.
                          value: rawxml
                        - description: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service.
                          value: rawxml-link
                  policyContent:
                    description: Json escaped Xml Encoded contents of the Policy.
                    type: string
                required:
                  - policyContent
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Policy
      x-ms-examples:
        ApiManagementGetPolicy:
          parameters:
            api-version: 2018-06-01-preview
            policyId: policy
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy
                name: policy
                properties:
                  policyContent: "<!--\r

                    \    IMPORTANT:\r

                    \    - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r

                    \    - Only the <forward-request> policy element can appear within the <backend> section element.\r

                    \    - 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

                    \    - 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

                    \    - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r

                    \    - To remove a policy, delete the corresponding policy statement from the policy document.\r

                    \    - Policies are applied in the order of their appearance, from the top down.\r

                    -->\r

                    <policies>\r

                    \  <inbound />\r

                    \  <backend>\r

                    \    <forward-request />\r

                    \  </backend>\r

                    \  <outbound />\r

                    </policies>"
                type: Microsoft.ApiManagement/service/policies
    head:
      description: Gets the entity state (Etag) version of the Global policy definition in the Api Management service.
      operationId: Policy_GetEntityTag
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The identifier of the Policy.
          enum:
            - policy
          in: path
          name: policyId
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: PolicyIdName
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: The current entity state version is present in the ETag header.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Policy
      x-ms-examples:
        ApiManagementHeadPolicy:
          parameters:
            api-version: 2018-06-01-preview
            policyId: policy
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200":
              headers:
                etag: AAAAAAAAAAa=
    put:
      description: Creates or updates the global policy configuration of the Api Management service.
      operationId: Policy_CreateOrUpdate
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The identifier of the Policy.
          enum:
            - policy
          in: path
          name: policyId
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: PolicyIdName
          x-ms-parameter-location: method
        - description: The policy contents to apply.
          in: body
          name: parameters
          required: true
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Policy Contract details.
            properties:
              properties:
                description: Policy contract Properties.
                properties:
                  contentFormat:
                    default: xml
                    description: Format of the policyContent.
                    enum:
                      - xml
                      - xml-link
                      - rawxml
                      - rawxml-link
                    type: string
                    x-ms-enum:
                      modelAsString: true
                      name: PolicyContentFormat
                      values:
                        - description: The contents are inline and Content type is an XML document.
                          value: xml
                        - description: The policy XML document is hosted on a http endpoint accessible from the API Management service.
                          value: xml-link
                        - description: The contents are inline and Content type is a non XML encoded policy document.
                          value: rawxml
                        - description: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service.
                          value: rawxml-link
                  policyContent:
                    description: Json escaped Xml Encoded contents of the Policy.
                    type: string
                required:
                  - policyContent
        - description: ETag of the Entity. Not required when creating an entity, but required when updating an entity.
          in: header
          name: If-Match
          required: false
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: Global policy configuration of the Api Management service was successfully updated.
          headers:
            ETag:
              description: Current entity state version
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Policy Contract details.
            properties:
              properties:
                description: Policy contract Properties.
                properties:
                  contentFormat:
                    default: xml
                    description: Format of the policyContent.
                    enum:
                      - xml
                      - xml-link
                      - rawxml
                      - rawxml-link
                    type: string
                    x-ms-enum:
                      modelAsString: true
                      name: PolicyContentFormat
                      values:
                        - description: The contents are inline and Content type is an XML document.
                          value: xml
                        - description: The policy XML document is hosted on a http endpoint accessible from the API Management service.
                          value: xml-link
                        - description: The contents are inline and Content type is a non XML encoded policy document.
                          value: rawxml
                        - description: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service.
                          value: rawxml-link
                  policyContent:
                    description: Json escaped Xml Encoded contents of the Policy.
                    type: string
                required:
                  - policyContent
        "201":
          description: Global policy configuration was successfully created.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Policy Contract details.
            properties:
              properties:
                description: Policy contract Properties.
                properties:
                  contentFormat:
                    default: xml
                    description: Format of the policyContent.
                    enum:
                      - xml
                      - xml-link
                      - rawxml
                      - rawxml-link
                    type: string
                    x-ms-enum:
                      modelAsString: true
                      name: PolicyContentFormat
                      values:
                        - description: The contents are inline and Content type is an XML document.
                          value: xml
                        - description: The policy XML document is hosted on a http endpoint accessible from the API Management service.
                          value: xml-link
                        - description: The contents are inline and Content type is a non XML encoded policy document.
                          value: rawxml
                        - description: The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service.
                          value: rawxml-link
                  policyContent:
                    description: Json escaped Xml Encoded contents of the Policy.
                    type: string
                required:
                  - policyContent
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Policy
      x-ms-examples:
        ApiManagementCreatePolicy:
          parameters:
            api-version: 2018-06-01-preview
            parameters:
              properties:
                contentFormat: xml
                policyContent: "<policies>\r

                  \  <inbound />\r

                  \  <backend>\r

                  \    <forward-request />\r

                  \  </backend>\r

                  \  <outbound />\r

                  </policies>"
            policyId: policy
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy
                name: policy
                properties:
                  policyContent: "<policies>\r

                    \  <inbound />\r

                    \  <backend>\r

                    \    <forward-request />\r

                    \  </backend>\r

                    \  <outbound />\r

                    </policies>"
                type: Microsoft.ApiManagement/service/policies
            "201":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policies/policy
                name: policy
                properties:
                  policyContent: "<policies>\r

                    \  <inbound />\r

                    \  <backend>\r

                    \    <forward-request />\r

                    \  </backend>\r

                    \  <outbound />\r

                    </policies>"
                type: Microsoft.ApiManagement/service/policies
definitions: {}
