ClearPayload attribute not working as expected in service callout policy

Hello Apigeeks,

I have created a shared flow for splunk logging, which contains a service callout to call splunk's event collector API from edge cloud. Now i want to use the shared flow at multiple places in my API proxies, but i face an issue since the same service callout policy in the shared flow is being used multiple times and the request variable of the service callout policy is persisted. This creates a problem for the request.uri context variable as it gets suffixed with the same value after every callout. For e.g. if the value during the first call is /event/collector/api, in the second call it becomes /event/collector/api/event/collector/api and the call fails.

I tried using clearPayload property in the policy to clear the request variable but it did not help.

Has anyone faced a similar issue ? Any suggestions for this ?

0 3 320
3 REPLIES 3

How about preceding the ServiceCallout with an AssignMessage to reset the URI to the empty string?

<AssignMessage name='AM-1'>
  <AssignVariable>
    <Name>request.uri</Name>
    <Value></Value>
  </AssignVariable>
</AssignMessage>

Hi Dino,

This solution did not work for me. In the trace i see the uri is within servicecallout.requesturi. Hence i tried to flush this as well in an AM policy, which i placed after the SC policy. That also did not help.

Shouldn't the clearPayload attribute of the SC policy worked in the first place. ?

yes, it should work that way. It's documented to work that way and I've never heard a report that it did not work that way. I can look into it, in a bit.