Analytics showing different http verb

Hello,

We have couple of APIs where HTTP verb is exposed as "GET" but before invoking the Target Endpoint, Request is transformed into "POST". While checking the analytics, we found out that for these APIs, request verb is showing as "POST" not "GET". I believe analytics for request verb should be looking at when request landed on Apigee not when it is transformed and sent to target.

Any idea ? Also which parameter can help in analytics to find actual request verb.

 

Thanks

 

0 1 65
1 REPLY 1

I think you can accomplish what you want by restoring the original value to request.verb after the response is received. 

You can do that with an AssignMessage policy, probably very similar to the one you used to overwrite the request.verb to switch from GET to POST.  Normally what you'd do is save the original value, overwrite it for the targetrequest, then, later, restore it for analytics. Do that with two AssignMessage policies, the first in the request flow, and the second in the target response flow. 

In the request flow:

<AssignMessage name='AM-overwrite-verb'>
  <AssignVariable> 
    <Name>original-request-verb</Name>
    <Ref>request.verb</Ref>
  </AssignVariable>
  <AssignVariable> 
    <Name>request.verb</Name>
    <Value>POST</Value>
  </AssignVariable>
</AssignMessage>

 

In the response flow:

<AssignMessage name='AM-restore-original-verb'>
  <AssignVariable> 
    <Name>request.verb</Name>
    <Ref>original-request-verb</Ref>
  </AssignVariable>
</AssignMessage>