request transformation

Hi There,

How would i have a variable requestNew, since i want to send this requestNew JSON object to the backend rather the request. Pls advice

Below is my request : Essentially i get in the request only one element and would like to add additional elements in json object.

Assign Message-1

{“foo”: “bar”, “hello”: “world”}

true

You can’t add extra items to the JSON payload with AssignMessage, but you could either:

A) create the payload using variables, like so:

<AssignMessagename="set-payload-3">
  <Set>
    <PayloadcontentType="application/json">
      {"name":"foo", "type":"{variable_name}"}
    </Payload>
  </Set>
</AssignMessage>

or

B) Use javascript callout(s) to build your JSON object, then stringify it and set it as the payload

1 Like