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.

<AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1"> <DisplayName>Assign Message-1</DisplayName> <Properties/>

<Set>

<Payload contentType="application/json; charset=utf-8">

{"foo": "bar", "hello": "world"}

</Payload>

</Set>

<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>

<AssignTo createNew="true" transport="http" type="request"/> </AssignMessage>

0 1 72
1 REPLY 1

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