Skip to content

Instantly share code, notes, and snippets.

<Step>
<!--the variable pathsuffix is evaluated to find the exact term "purchase"-->
<Condition>proxy.pathsuffix /~ &quot;/purchase&quot;</Condition>
<FaultRules/>
<Name>publishPurchaseDetails</Name>
</Step>
@ApigeeSamples
ApigeeSamples / sampleproxy.xml
Created May 2, 2012 22:47
proxy file example
<?xml version="1.0"?>
<ProxyEndpoint name="proxy">
<Flows>
<Flow>
<Request/>
<!==you can place policies in either the Request or Response flow. Here the JSON to XML policy is in the Response flow==>
<Response>
<!==each policy is defined as a Step. The actual policy is defined in another xml file stored in the stepdefinitions folder.==>
<Step>
<FaultRules/>
<JSONToXML name="myPolicy">
<Source>request</Source>
<OutputVariable>response</OutputVariable>
<Options>
<InvalidCharsReplacement>_</InvalidCharsReplacement>
<TextNodeName>#text</TextNodeName>
<NullValue>I_AM_NULL</NullValue>
<AttributeBlockName>#attrs</AttributeBlockName>
<AttributePrefix>@</AttributePrefix>
<NamespaceBlockName>#namespaces</NamespaceBlockName>
@ApigeeSamples
ApigeeSamples / responsecache.xml
Last active October 4, 2015 11:08
Response Caching
<ResponseCache name="ResponseCache">
<CacheResource>mycache</CacheResource>
<Scope>Global</Scope>
<CacheKey>
<Prefix>Apigee</Prefix>
<KeyFragment ref="request.path" />
</CacheKey>
<SkipCacheLookup>{condition}</SkipCacheLookup>
<SkipCachePopulation>{condition}</SkipCachePopulation>
<ExpirySettings>
<XMLToJSON name="mypolicy">
<Source>request</Source>
<OutputVariable>response</OutputVariable>
<Options>
<RecognizeNumber>true</RecognizeNumber>
<RecognizeBoolean>true</RecognizeBoolean>
<RecognizeNull>true</RecognizeNull>
<NullValue>NULL</NullValue>
<NamespaceSeparator>%</NamespaceSeparator>
<NamespaceBlockName>#namespaces</NamespaceBlockName>
@ApigeeSamples
ApigeeSamples / InvalidateCache.xml
Last active October 4, 2015 11:18
Invalidate Cache
<InvalidateCache name="InvalidateMyCache">
<CacheResource>mycache</CacheResource>
<Scope>Global/Application/Proxy/Target</Scope>
<CacheContext>
<APIProxyName>myapp</APIProxyName>
<ProxyName>myproxy</ProxyName>
<TargetName>mytarget</TargetName>
<CacheContext>
<CacheKey>
<Prefix>cache-key-prefix</Prefix>
<LookupCache name="LookupMyCache">
<CacheResource>mycache</CacheResource>
<AssignTo>{flow variable}</AssignTo>
<Scope>Global/Application/Proxy/Target/Exclusive</Scope>
<CacheKey>
<Prefix>UserToken</Prefix>
<KeyFragment ref="request.header.id1" />
<KeyFragment ref="request.header.id2" />
</CacheKey>
</LookupCache>
@ApigeeSamples
ApigeeSamples / xsl.xml
Created May 7, 2012 13:18
XSL transformation
<XSL name="xslPolicy">
<Source>...</Source>
<OutputVariable>...</OutputVariable>
<ResourceURL>xsl://sample</ResourceURL>
<Parameters ignoreUnresolvedVariables="true/[false]">
<Parameter name="p1" value="value1"/>
<Parameter name="p2" ref="request.header.greeting"/>
</Parameters>
</XSL>
@ApigeeSamples
ApigeeSamples / cache.xml
Created May 7, 2012 10:49
Cache resource configuration
<Cache name="mycache">
<Description>Cache description</Description>
<MaxElementsInMemory>100</MaxElementsInMemory>
<MaxElementsOnDisk>1000</MaxElementsOnDisk>
<OverflowToDisk>true</OverflowToDisk>
<Persistent>false</Persistent>
<ExpirySettings>
<TimeoutInSec>300</TimeoutInSec>
</ExpirySettings>
<Compression>
<PopulateCache name="PopulateMyCache">
<CacheResource>mycache</CacheResource>
<Source>{flow variable}</Source>
<Scope>Global/Application/Proxy/Target/Exclusive</Scope>
<CacheKey>
<Prefix>cache-key-prefix</Prefix>
<KeyFragment ref="request.header.id1" />
<KeyFragment ref="request.header.id2" />
</CacheKey>
<ExpirySettings>