Question

How to Capture Outbound REST API Calls from Pega to external systems for Auditing?
When working with Pega, capturing outbound REST API calls for auditing purposes can be a challenge. In this post, we’ll explore a generalized solution to address this issue. We’ll focus on the latest Pega versions, where direct methods for capturing raw request and response messages in connect-Rest calls are not readily available.
As i am aware, there is no straightforward mechanism to capture the raw request and response messages for connect-Rest calls. Even after scouring the Pega documentation and various support articles, users often find themselves without a clear solution (apart from converting pega page to json). However, got a workaround that involves setting Param.storeRawMessage=true
before making the connect-Rest API call. This trick, shared by Dmitry (though not documented officially), allows you to capture the request and response payloads. We could see the Raw message from Clipboard, screenshot is attached.
When working with Pega, capturing outbound REST API calls for auditing purposes can be a challenge. In this post, we’ll explore a generalized solution to address this issue. We’ll focus on the latest Pega versions, where direct methods for capturing raw request and response messages in connect-Rest calls are not readily available.
As i am aware, there is no straightforward mechanism to capture the raw request and response messages for connect-Rest calls. Even after scouring the Pega documentation and various support articles, users often find themselves without a clear solution (apart from converting pega page to json). However, got a workaround that involves setting Param.storeRawMessage=true
before making the connect-Rest API call. This trick, shared by Dmitry (though not documented officially), allows you to capture the request and response payloads. We could see the Raw message from Clipboard, screenshot is attached.
Now, here’s where things get interesting. After successfully capturing the raw response using the method step-page, i encountered a roadblock. The pyRawMessage
property, which contains the raw response data, isn’t directly accessible for reading. But tried an alternative technique involving Java code that captures the raw message.
//String request = myStepPage.getStringIfPresent("pyRawMessage");
ClipboardPage cp = tools.findPage("UKPostcodeGetPage");
ClipboardProperty request = cp.getProperty("pyRawMessage");
oLog.infoForced("Request-->>"+request.getStringValue());
pega_rules_utilities.sendDebugMessageToTracer("Request-->>"+request.getStringValue(),"MyRS");
Have you faced this behavior in Pega? Do you know why pyRawMessage
remains elusive? Perhaps you’ve discovered other clever ways to capture the connect-rest response in its raw, unadulterated form (without converting it to a JSON string)? Looking forward to hearing from the experts.
Thanks,
Nanjundan Chinnasamy | Pega Lead Decision Architect | 1:1 Customer Engagement