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

Extract variables policy is not working as expected.

Tried to search and extract few elements from JSON payload using Extract Variables policy. Responded no values with 200 response.

FYI: tried response.content value for the <Source> tag. @Anil Sagar @ Google @Dino-at-Google @Siddharth Barahalikar

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="EV-ExtractEmployeeInfo">
    <DisplayName>EV-ExtractEmployeeInfo</DisplayName>
    <Properties/>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <JSONPayload>
        <Variable name="name">
            <JSONPath>$.[?(@.id=='66712')].employee_name</JSONPath>
            <!-- Returns specific value as array ["pod1"] -->
        </Variable>
        <Variable name="salary">
            <JSONPath>$.[?(@.id=='66712')].employee_salary</JSONPath>
            <!-- Returns specific value as string pod1 -->
        </Variable>
    </JSONPayload>
    <Source clearPayload="false">response</Source>
</ExtractVariables>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SetEmployeeInfo">
    <DisplayName>AM-SetEmployeeInfo</DisplayName>
    <AssignTo createNew="false" type="response"/>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <Set>
        <Payload contentType="application/json" variablePrefix="@" variableSuffix="#">
        {"name":"@name#", "salary":"@salary#"}
    </Payload>
    </Set>
</AssignMessage>

Expected response

{
 "name": "["Rahul3210"]",
 "salary": "["30000"]"
}

Actual Response

{
 "name": " ",
 "salary": ""
}

PFA the image which shows the response payload where we extract the elements.original-response-payload.png

1 16 722
16 REPLIES 16