You can use Assign Message to embed dynamic content in the payload of response and request messages.
To embed Edge flow variables in an XML payload, wrap the designated variable in curly
braces, like this: {prefix.name}
.
The following example embeds the value of the user-agent
HTTP header flow variable
in an XML element called User-agent
:
<AssignMessage name="set-dynamic-content"> <AssignTo createNew="false" type="response"></AssignTo> <Set> <Payload contentType="text/xml"> <User-agent>{request.header.user-agent}</User-agent> </Payload> </Set> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> </AssignMessage>
For JSON payloads, you can insert variables using the variablePrefix
and
variableSuffix
attributes with delimiter characters as shown in the following
example:
<AssignMessage name="set-payload"> <Payload contentType="application/json" variablePrefix="@" variableSuffix="#"> { "user-agent": "@request.header.user-agent#" } </Payload> </AssignMessage>
For a complete list of flow variables, see Flow variables reference.
As of cloud release 16.08.17, you can also use curly braces to insert variables.