What is the best practice for sniffing API traffic (API mirroring) to external server ?

I want to add a policy in which each API request and response will generate a new API Request to an external server containing the meta-data of the original request as parameters (think about it as sniffing the original request\response and send a mirror to an external server).

So far, I saw the option to use AssignMessage and ServiceCallout - but my concern is that this option is not asynchronous and it can delay the process of the original request.

My question is what is the best practice to achieve this.

Solved Solved
0 2 1,574
1 ACCEPTED SOLUTION

ServiceCallout is not async; although that is changing. (The doc says it's async, but today it does not behave that way. We're fixing that implementation)

You can use the JavaScript step and the httpClient to send a fire-and-forget request.

https://community.apigee.com/questions/38020/using-httpclient-from-within-javascript-callout-is.html

View solution in original post

2 REPLIES 2

ServiceCallout is not async; although that is changing. (The doc says it's async, but today it does not behave that way. We're fixing that implementation)

You can use the JavaScript step and the httpClient to send a fire-and-forget request.

https://community.apigee.com/questions/38020/using-httpclient-from-within-javascript-callout-is.html

@Ari Heber You can also consider exploring option of using MessageLogging Policy. It works in async mode. In this case external server will be sys log server.

Here is the link to documentation page

https://docs.apigee.com/api-platform/reference/policies/message-logging-policy

See if it fits with your requirement and what you are trying to achieve.