Thanks a lot Leon. I tried this code snippet but I got the below error:
“Failed to run JS middleware”. Then I tried stringify the payload object variable passed to the request Body as shown below:
newRequest = {
"Method": "POST",
"Body": JSON.stringify(payload)
}
It now works. I appreciate your support. Thanks.