Hi guys, I have a proxy with one GETand POST methods. I used Response Cache policy.
Now the GET reuqests execute fine but POST request are not reflecting in the backend(BaaS).
If I remove the response cache then POST request gets updated in BaaS.
Is there a way/condition by which I can disable response cache while POST request?
Note- For POST I'm using an Ajax call outside Apigee.
Solved! Go to Solution.
If you simply want to skip the cache lookup and cache population for POST calls, you can use SkipCacheLookupthe SkipCachePopulation elements in your cache policy. For example:
<SkipCacheLookup>request.verb = "POST"</SkipCacheLookup>
This would skip the cache lookup, similar thing can be done for SkipCachePopulation. You can refer to the docs here: http://apigee.com/docs/api-services/reference/response-cache-policy#element_reference for more details
Hi @Barahalikar Siddharth , Put GET and POST in different flows and attach response cache in that particular flow or put a condition flow for response cache to be executed only in case of GET .
<Flow name="forecast"> <Description/> <Request> <Step> <FaultRules/> <Name>responsecache-1</Name> </Step> </Request> <Response> <Step> <FaultRules/> <Name>responsecache-1</Name> </Step> </Response> <Condition>(proxy.pathsuffix MatchesPath "/forecastrss") and (request.verb = "GET")</Condition> </Flow>
or
<Step> <FaultRules/> <Condition>(request.verb = "GET")</Condition> <Name>responsecache-1</Name> </Step>
#1 is cleaner approach though .
If you simply want to skip the cache lookup and cache population for POST calls, you can use SkipCacheLookupthe SkipCachePopulation elements in your cache policy. For example:
<SkipCacheLookup>request.verb = "POST"</SkipCacheLookup>
This would skip the cache lookup, similar thing can be done for SkipCachePopulation. You can refer to the docs here: http://apigee.com/docs/api-services/reference/response-cache-policy#element_reference for more details
Hi @Barahalikar Siddharth , Put GET and POST in different flows and attach response cache in that particular flow or put a condition flow for response cache to be executed only in case of GET .
<Flow name="forecast"> <Description/> <Request> <Step> <FaultRules/> <Name>responsecache-1</Name> </Step> </Request> <Response> <Step> <FaultRules/> <Name>responsecache-1</Name> </Step> </Response> <Condition>(proxy.pathsuffix MatchesPath "/forecastrss") and (request.verb = "GET")</Condition> </Flow>
or
<Step> <FaultRules/> <Condition>(request.verb = "GET")</Condition> <Name>responsecache-1</Name> </Step>
#1 is cleaner approach though .
Thank you @arghya das & @Maruti Chand
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |