how can i add body parameters in service callout policy

how can i add body parameters in service callout policy

Note:

{ "formatId":"", "formatName":"", "limit":3, "page":1, "partnerCode":"WEA", "status":"", "summaryActivityDate":"2018-05-07", "uploadId":"" }

1 2 2,209
2 REPLIES 2

Add with Payload as shown below

<ServiceCallout async="false" continueOnError="false" enabled="true" name="SC-MyCallout">
    <DisplayName>SC-MyCallout</DisplayName>
    <Properties/>
    <Request clearPayload="false" variable="calloutReq">
        <Set>
            <Headers/>               
            <Verb>POST</Verb>
            <Path>/calloutpath</Path>
            <Payload contentType="application/json">
           { "formatId":"", "formatName":"", "limit":3, "page":1, "partnerCode":"WEA", "status":"", "summaryActivityDate":"2018-05-07", "uploadId":"" }
            </Payload>
        </Set>
        <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    </Request>
    <Response>calloutRes</Response>
    <HTTPTargetConnection>
        <Properties/>
        <URL>https://callouturl</URL>
    </HTTPTargetConnection>
</ServiceCallout>

To use form params, as is typical for oauth token requests to a backend IdP you can use:

<ServiceCallout async="false" continueOnError="false" enabled="true" name="SC-AuthenticateUser">
    <DisplayName>SC-AuthenticateUser</DisplayName>
    <Properties/>
    <Request>
        <Set>
            <Headers>
                <Header name="Content-Type">application/x-www-form-urlencoded</Header>
            </Headers>
            <FormParams>
                <FormParam name="grant_type">password</FormParam>
                <FormParam name="username">{externalUsername}</FormParam>
                <FormParam name="password">{externalPassword}</FormParam>
            </FormParams>
            <Verb>POST</Verb>
            <Path/>
        </Set>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    </Request>
    <Response>authenticate.response</Response>
    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="oauth-backend-v1"/>
        </LoadBalancer>
        <Path>{flow.target.basepath}/{flow.target.tokenPathsuffix}</Path>
    </HTTPTargetConnection>
</ServiceCallout>