Last activity: 12 Aug 2018 16:48 EDT
pyRequestData Param data in Connect-rest
How can we print pyRequestData (Which Contains JSON Request) in Connect-Rest invocation ? If i use Param.pyRequestData , nothing is logged .
Attached is the screen for reference .
Appreciate you response .
JPMorgan Chase & Company
I hope you want print request data in log file. please enable debug level logging in below class to get that.
Thanks , but if we need to do in in our activity , is there any way we can capture from Param page ?
P.S : Making this to debug also works - Rule_Obj_Activity.pyInvokeRESTConnector.Rule_Connect_REST.Action
Did you try as below in java step?
String request= tools.getParamValue("pyRequestData");
its not working , attched is the cdoe and tracer screen
Any help is much appreciated , Thanks
Please see this post https://collaborate.pega.com/idea/how-do-you-get-raw-json-clipboard-conversion
I had exactly the same issue as yourself and I implemented the function the post refers to and it works.
Thanks Craig , so we cannot directly use pyRequestData paramater ? only way is to write a function as in the link you provided
If you need in a JSON format, you can use the function @pxConvertPageToString(tools,Primary,json).
after connect rest method , below java code can be inserted to print the request in JSON.
ParameterPage TestPP = tools.getParameterPage();
java.util.HashMap TestreqMessageData = new java.util.HashMap();
TestreqMessageData = (java.util.HashMap) TestPP.getObject("pyRequestData");
Iterator it = TestreqMessageData.entrySet().iterator();
Map.Entry pair = (Map.Entry)it.next();
String strReqJSON = (String) pair.getValue();
oLog.infoForced("Connect-Rest Request is : "+strReqJSON);