Skip to content

Instantly share code, notes, and snippets.

<RaiseFault name="abc">
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<FaultResponse>
<Copy source="sc.response"> <!-- source is optional.. default is message -->
<Headers />
</Copy>
<Remove>
<Headers>
<Header name="h1"/>
</Headers>
@ApigeeSamples
ApigeeSamples / Servicecallout.xml
Last active October 4, 2015 11:27
Service Callout
<ServiceCallout name="myPolicy">
<Request clearPayload="false" variable="myRequest"/>
<Response>myResponse</Response>
<HTTPTargetConnection>
<Properties/>
<URL>http://example.com</URL>
</HTTPTargetConnection>
</ServiceCallout>
<MessageValidation name="myPolicy">
<Source>mymessage</Source>
<ResourceURL>xsd://sample</ResourceURL>
<SOAPMessage version="1.1/1.2"/>
<Element namespace="http://finance.com/1999"> PurchaseOrder</Element>
<Element namespace="http://finance.com/2000">PurchaseOrder</Element>
</MessageValidation>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JavaCallout name="MyJavaCalloutPolicy">
<ResourceURL>java://MyJavaCallout.jar</ResourceURL>
<ClassName>com.apigee.mypolicy.Javacallout.MyJavaCallout</ClassName>
</JavaCallout>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Script name="MyPythonScriptPolicy">
<ResourceURL>py://MyPythonScript</ResourceURL>
<IncludeURL>py://MyPythonScript</IncludeURL>
</Script>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Javascript timeLimit="200" enabled="true" continueOnError="false" async="false" name="MyJSPolicy">
<ResourceURL>jsc://MyJavaScript</ResourceURL>
<IncludeURL>jsc://MyJavaScript</IncludeURL>
</Javascript>
<ExtractVariables name="mypolicy">
<Source>sc.response</Source>
<VariablePrefix>apigee</VariablePrefix>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<Pattern>/**/hello/{user}</Pattern>
<Pattern>/**/hi/{user}</Pattern>
</URIPath>
<QueryParam name="greeting">
<Pattern>hello {user}</Pattern>
@ApigeeSamples
ApigeeSamples / KeyValueMapOperations.xml
Last active October 4, 2015 12:17
Key Value Map Operations
<KeyValueMapOperations name="abc">
<Scope>organization/environment/apiproxy/policy</Scope>
<ExpiryTimeInSecs>60</ExpiryTimeInSecs>
<InitialEntries>
<Entry>
<Key>
<Parameter>k1</Parameter>
</Key>
<Value>v1</Value>
<Value>v2</Value>
@ApigeeSamples
ApigeeSamples / RegularExpressionProtection.xml
Created May 8, 2012 10:08
Regular Expression Protection
<RegularExpressionProtection name="mypolicy">
<Source>response</Source>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<URIPath>
<Pattern>[tT]rue</Pattern>
<Pattern>.*true.*</Pattern>
</URIPath>
<QueryParam name="greeting">
<Pattern>[tT]rue</Pattern>
<Pattern>.*true.*</Pattern>
<RaiseAlert name="RaiseAlert">
<Syslog>
<Message>This is a test message. id = {request.header.id}</Message>
<Host>IP</Host>
<Port>514</Port>
</Syslog>
</RaiseAlert>