Google RateExceededError.RATE_EXCEEDED error using 'download_report' query.

67 views
Skip to first unread message

Murtaza Basrai

unread,
Nov 18, 2019, 2:32:02 AM11/18/19
to AdWords API and Google Ads API Forum
Hello,

I am using the Gem `gem 'google-adwords-api', '~> 1.5.0'` in my ruby project.
report_definition = {
    selector: {
        fields: %w(CampaignId Impressions Clicks Cost),
        # Predicates are optional.
        predicates: {
            field: 'CampaignId',
            operator: 'IN',
            values: campaigns.collect { |c| c[:id] }
        },
        date_range: {min: start_date, max: start_date}
    },
    report_name: '-',
    report_type: 'CAMPAIGN_PERFORMANCE_REPORT',
    download_format: 'XML',
    date_range_type: 'CUSTOM_DATE'
}

Calling the API to get the campaigns:
target_xml = report_utils.download_report(report_definition)


This is throwing the following error:

AdwordsApi::Errors::ReportXmlError: HTTP code: 400, error type: 'RateExceededError.RATE_EXCEEDED', trigger: 'Basic Access Daily Reporting Quota', field path: ''

The documentation says that with the rate limit, I should receive other fields such as "rateScope, rateName, retryAfterSeconds"but I cannot find those additional params to debug the issue.
This error started coming since 14th November. It's critical for us to rectify, so can someone help me what we could be missing here or if something changed from API side?

Thank you,
Murtaza Basrai

Google Ads API Forum Advisor Prod

unread,
Nov 18, 2019, 2:41:57 PM11/18/19
to murtaz...@gmail.com, adwor...@googlegroups.com

Hi Murtaza,

Thanks for reaching out. Please follow this guide on how to enable the logging in the Ruby client library to get the complete logs of the SOAP request and response. Please let us know if you still have questions after trying this.

Thanks and regards,
Xiaoming, Google Ads API Team



ref:_00D1U1174p._5001UOCPTv:ref

Murtaza Basrai

unread,
Nov 19, 2019, 1:54:53 AM11/19/19
to Google Ads API Forum Advisor Prod, adwor...@googlegroups.com
Hi Xiaoming,

Thanks a lot for the quick reply.

I added the logger as mentioned, but it logs only the requests and not the SOAP response of the error (Please find the details below).

Here’s the snippet of the code:

```
API_VERSION = :v201809
api = AdwordsApi::Api.new(config)
report_utils = api.report_utils(API_VERSION)

report_definition = {
    selector: {
        fields: %w(CampaignId Impressions Clicks Cost),
        # Predicates are optional.
        predicates: {
            field: 'CampaignId',
            operator: 'IN',
            values: campaigns.collect { |c| c[:id] }
        },
        date_range: {min: start_date, max: start_date}
    },
    report_name: '-',
    report_type: 'CAMPAIGN_PERFORMANCE_REPORT',
    download_format: 'XML',
    date_range_type: 'CUSTOM_DATE'
}

target_xml = report_utils.download_report(report_definition)

```

Log from console:

```
.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/google-adwords-api-1.5.0/lib/adwords_api/report_utils.rb:300:in `check_for_xml_error': HTTP code: 400, error type: 'RateExceededError.RATE_EXCEEDED', trigger: 'Basic Access Daily Reporting Quota', field path: '' (AdwordsApi::Errors::ReportXmlError)
from .rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/google-adwords-api-1.5.0/lib/adwords_api/report_utils.rb:284:in `check_for_errors’
```

Logs from logger file:

```
D, [2019-11-19T12:15:49.259816 #90398] DEBUG -- : Report request to: 'https://adwords.google.com/api/adwords/reportdownload/v201809'
D, [2019-11-19T12:15:49.259882 #90398] DEBUG -- : HTTP headers: [Content-Type: application/x-www-form-urlencoded, Authorization: Bearer <token>, User-Agent: <agent> (AwApi-Ruby/1.5.0, Common-Ruby/1.0.2, GoogleAdsSavon/1.0.3, ruby/2.4.4, HTTPI/2.4.4, httpclient), clientCustomerId: <client id>, developerToken: <token>]

D, [2019-11-19T12:15:49.259915 #90398] DEBUG -- : __rdxml=%3CreportDefinition%3E%3Cselector%3E%3Cfields%3ECampaignId%3C%2Ffields%3E%3Cfields%3EImpressions%3C%2Ffields%3E%3Cfields%3EClicks%3C%2Ffields%3E%3Cfields%3ECost%3C%2Ffields%3E%3Cpredicates%3E%3Cfield%3ECampaignId%3C%2Ffield%3E%3Coperator%3EIN%3C%2Foperator%3E%3Cvalues%3E<value>%3C%2Fpredicates%3E%3CdateRange%3E%3Cmin%3E20191118%3C%2Fmin%3E%3Cmax%3E20191118%3C%2Fmax%3E%3C%2FdateRange%3E%3C%2Fselector%3E%3CreportName%3E-%3C%2FreportName%3E%3CreportType%3ECAMPAIGN_PERFORMANCE_REPORT%3C%2FreportType%3E%3CdateRangeType%3ECUSTOM_DATE%3C%2FdateRangeType%3E%3CdownloadFormat%3EXML%3C%2FdownloadFormat%3E%3C%2FreportDefinition%3E
D, [2019-11-19T12:15:49.260264 #90398] DEBUG -- : HTTPI /peer POST request to adwords.google.com (httpclient)
D, [2019-11-19T12:15:50.833572 #90398] DEBUG -- : HTTP headers: [Content-Type: text/xml, Content-Encoding: gzip, Date: Tue, 19 Nov 2019 06:45:50 GMT, Expires: Tue, 19 Nov 2019 06:45:50 GMT, Cache-Control: private, max-age=0, X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, X-XSS-Protection: 1; mode=block, Server: GSE, Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000, Transfer-Encoding: chunked]
```

Can you guide me in what could be the possible reason for rate limit error and how to fix it?
The code has not changed in last 5 months, but this RateLimitIssue started coming only from 14th November 2019.

-
Thank you,
Murtaza Basrai
Reply all
Reply to author
Forward
0 new messages