Mapping Two Different JSON Payload Using Body Transform

I am trying to map parameters inside two different JSON payload which communicate with distinguished endpoints. However I dont know if I can use Body transform alongside with virtual endpoint plugin(as there is a logic around VP already). Assuming the first payload has destinationAccount, narration ; and the second payload has accountToCredit, purpose which perform the same thing on their distinguished endpoint. I mapped the two data in Body Transform template as shown below:
“accountToCredit”: “{{.destinationAccount}}”,
“purpose”: “{{.narration}}”
Then I call the below on postman to trigger the endpoint that uses destinationAccount,narration
{
“accountToCredit”: “0000001”,
“purpose”: “testing”
}
But I get this error on Postman: “Bad request”.
Is there anything I have done wrong? Kindly assist

Hi Oyinda,

You should be ok to use a Body Transform together with a virtual endpoint. Perhaps there is something in your virtual endpoint that is causing the issue? Also, reading your description it sounds like you are calling the destinationAccount endpoint, but passing in an accountToCredit payload? The body transform you shared expects a destinationAccount payload, and transforms that to accountToCredit.

cheers,
Andy

Thanks Smith. I’m now okay. I eventually used virtual endpoint for the mapping because I already have some logic in it. And it works fine. I appreciate.