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

How do I extract values from json NOT using extract variables policy

How do I extract values from a json payload and use it directly without using extract variable policy and assign message policy.

My intent here is to use the values from payload to do a service callout

For example :

Input request

{

"key1":"value1",

"key2":"value2"

}

use these values in service callout as query param

I've tried using

{jsonPath($.key1)}

{request.formparam.key1}

{$.key1}

nothing worked.

Below is the policy code if it helps

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Info_Service">
    <DisplayName>Info_Service</DisplayName>
    <Properties/>
    <Request clearPayload="true">
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
        <Set>
            <QueryParams>
                <QueryParam name="info">{jsonPath($.key1,request.content)}</QueryParam>
            </QueryParams>
            <Verb>GET</Verb>
        </Set>
    </Request>
    <Response>calloutResponse</Response>
    <LocalTargetConnection>
        <APIProxy>infoService</APIProxy>
        <ProxyEndpoint>/abc/bbc/def</ProxyEndpoint>
    </LocalTargetConnection>
</ServiceCallout>
1 8 597
8 REPLIES 8