How to detect RESOURCE_TEMPORARILY_EXHAUSTED error type

38 views
Skip to first unread message

Marc Donis

unread,
Jul 20, 2022, 10:43:09 AM7/20/22
to Google Ads API and AdWords API Forum
We would like to know when a QuotaError has the type RESOURCE_TEMPORARILY_EXHAUSTED.

Here is the code we have so far:


} catch (GoogleAdsException gae) {
        for (final GoogleAdsError err : gae.getGoogleAdsFailure().getErrorsList()) {
            if (err.getDetails().hasQuotaErrorDetails()) {
                // no idea how to check for this type:
                //   QuotaErrorEnum.QuotaError.RESOURCE_TEMPORARILY_EXHAUSTED;
                System.out.println(
                        "GoogleAdsException has QuotaErrorDetails. assuming RESOURCE_TEMPORARILY_EXHAUSTED and trying again...");
            }
        }
}

Google Ads API Forum Advisor

unread,
Jul 20, 2022, 12:53:04 PM7/20/22
to adoni...@gmail.com, adwor...@googlegroups.com
Hi Marc,

Thank you for reaching out to the Google Ads API support team.

Kindly note that the RESOURCE_EXHAUSTED error generally occurs when you are sending too many requests in a short period of time. The server throws this error once it detects that your request has exceeded the system frequency limit. I would recommend setting up short delays between requests or combine more operations in fewer requests.

Please refer to the Best practices guide to optimize the efficiency and performance. Also, this may occur if you have already exceeded the daily limit of 15,000 API operations per day. You may refer to this documentation for the quota you need to consider daily when performing requests using the API.

It says that the basic access level allows the developer token to execute up to 15,000 operational requests per day and 1,000 get operations per day only. However, we would request that you provide the complete request and response logs, with the request-id, generated for the RESOURCE_EXHAUSTED error in order to check further. You can enable logging, which you may do so by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. Please reply via privately author option. Let me know if you have any questions.

Thanks,
Google Logo
Nirmitabahen Gaurav
Google Ads API Team
 


ref:_00D1U1174p._5004Q2bm0wl:ref

Marc Donis

unread,
Jul 21, 2022, 1:01:16 AM7/21/22
to Google Ads API and AdWords API Forum
Thanks, but that didn't really answer my question.

Can you please provide a code example showing where to find this QuotaErrorEnum.QuotaError.RESOURCE_TEMPORARILY_EXHAUSTED value? I don't see where this enum is actually used.

Google Ads API Forum Advisor

unread,
Jul 21, 2022, 3:13:15 AM7/21/22
to adoni...@gmail.com, adwor...@googlegroups.com
Hi Marc,

Thank you for the reply.

You may check this documentation as it provides sample code  for  Handle Rate Exceeded Error. Moving forward,  could you confirm  what client library code example you are looking for to find this QuotaErrorEnum.QuotaError.RESOURCE_TEMPORARILY_EXHAUSTED value? You may check our supported client library here . Also note that you can browse specific client library code for getting enums.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2bm0wl:ref

Marc Donis

unread,
Jul 21, 2022, 10:43:44 AM7/21/22
to Google Ads API and AdWords API Forum
Thank you! This appears to be exactly what I need:

        for (final GoogleAdsError googleAdsError : gae.getGoogleAdsFailure().getErrorsList()) {
            final QuotaError quotaError = googleAdsError.getErrorCode().getQuotaError();
            if (quotaError == QuotaError.RESOURCE_EXHAUSTED
                    || quotaError == QuotaError.RESOURCE_TEMPORARILY_EXHAUSTED) {

            }
        }

Google Ads API Forum Advisor

unread,
Jul 21, 2022, 1:57:15 PM7/21/22
to adoni...@gmail.com, adwor...@googlegroups.com
Hi Marc,

Thank you for reaching out to the Google Ads API support team.

Let me know if you need any question related to the API. 

Thanks,
Google Logo
Nirmitabahen Gaurav
Google Ads API Team
 


ref:_00D1U1174p._5004Q2bm0wl:ref
Reply all
Reply to author
Forward
0 new messages