I have a request with payload and i need to append new attribute into the existing payload(“request.content”) before hitting the backend. Is it possible to do that via Service callout? Tried the same using Js and got the expected payload.But looking for precompiled policy to do that. any help?
Sample
Original request payload
{"attribute1":"Value1"}
Expected request payload
{"attribute1":"Value1","attribute2":"Value2"}
@maivizhi , I don’t think you can manipulate the payload using policies other than extension policies like JS / Python / java callouts. I don’t think there is a precompiled policy just to do that. You need to use JS / Python / Java policies to do same.
@Carlos Eberhardt As service callout policy allows to add additional queryparam to the request before hitting the target ,i tried the same for request content too. Now , am clear that it can’t be done.Thanks @Anil Sagar and @Carlos Eberhardt.
This can be done. First, you would use an Extract Variables Policy to get the attribute1 and then use an Assign Message Policy to change the body of the payload to be what you want it to be or assign the request directly in Service Callout Policy in the payload section.
But the suggested method is using JS/Java callout/Python.