Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Handling servicecallout response

Not applicable

In my code, I have a ServiceCallout to Google geocode API. Once the ServiceCallout returns, I want to check for errors in the geocode API call.

The problem with Google Geocode API is it returns an HTTP 200 in all case. However, the error is returned like this:

{
    "error_message": "You have exceeded your daily request quota for this API.",
    "results": [],
    "status": "OVER_QUERY_LIMIT"
}

So, in order for me to check the error, I need to check for the "status" field in the calloutResponse object. ("Status" != "OK")

What is the smartest way to set the condition statement for a RaiseFault policy? The following does NOT work, as calloutResponse.content is a string.

                <Step>
                    <Name>RF-SC-Failure</Name>
                    <Condition>(calloutResponse.content.status != "OK")</Condition>
                </Step>

Please help.

Regards,

Ritwik

Solved Solved
0 1 237
1 ACCEPTED SOLUTION

Hi @ritwik_chatterjee, generally we use an Extract Variable policy after SC, extract the status & then use a RF with status condition

View solution in original post

1 REPLY 1

Hi @ritwik_chatterjee, generally we use an Extract Variable policy after SC, extract the status & then use a RF with status condition