Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

extract variable with the new request object

Hi There,

The below is my client request to proxy. Essentially am creating a new request object with myRequest using assign message which should contain the payload sent by the client and trying to extract JSON elements from that newly created myRequest object in extract variable, but I couldn't get the myRequest object to the extract variable. See below for the payload and other necessary info. The bottom line is to extract the JSON elements from the newly created object that I couldn't do work it out.Not sure where am missing.pls advice.

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

AssignMessage:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="AM-changeReqName"> <DisplayName>AM-changeReqName</DisplayName>

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

<AssignVariable>

<Name>myRequestVar</Name> <Ref>request.content</Ref>

</AssignVariable>

ExtractVariable:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="false" enabled="true" name="EV-jsonInputValidation"> <DisplayName>EV-jsonInputValidation</DisplayName> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>

<Source clearPayload="false">myRequest</Source>

<JSONPayload>

<Variable name="name1"> <JSONPath>$.foo</JSONPath> </Variable>

<Variable name="name2"> <JSONPath>$.hello</JSONPath> </Variable>

</JSONPayload>

</ExtractVariables>

0 2 162
2 REPLIES 2