Edit

Include fragment

APPLIES TO: All API Management tiers

The include-fragment policy inserts the contents of a previously created policy fragment in the policy definition. A policy fragment is a centrally managed, reusable XML policy snippet that can be included in policy definitions in your API Management instance.

The policy inserts the policy fragment as-is at the location you select in the policy definition.

Note

Set the policy's elements and child elements in the order provided in the policy statement. Learn more about how to set or edit API Management policies.

Policy statement

<include-fragment fragment-id="fragment" />

Attributes

Attribute Description Required Default
fragment-id A string. Specifies the identifier (name) of a policy fragment created in the API Management instance. Policy expressions aren't allowed. Yes N/A

Important

Linked access isn't checked when a policy fragment is referenced by using fragment-id. A user who has permission to write a policy can reference any available policy fragment and cause API Management to execute its policy statements, even if the user doesn't have read access to the policy fragment resource. This doesn't grant access to view or modify the policy fragment definition.

Usage

Example

In the following example, the policy fragment named myFragment is added in the inbound section of a policy definition.

<inbound>
    <include-fragment fragment-id="myFragment" />
    <base />
</inbound>
[...]

For more information about working with policies, see: