RateExceededError when migrating to v201708 - PHP

94 views
Skip to first unread message

Alejandro Claure

unread,
Sep 25, 2017, 4:33:48 PM9/25/17
to AdWords API Forum
I've been trying to switch my php web app to use v201708 (currently v201609)

As soon as do the switch i start receiving:

[Google\AdsApi\AdWords\v201708\cm\ApiException]
[RateExceededError <rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30>]

If i switch back to the old version, everything seems to work fine.

I'm using the same account in both cases, not doing additional operations than these.

call:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
       xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 <SOAP-ENV:Header>
              <ns1:RequestHeader>
                    <ns2:clientCustomerId>REDACTED</ns2:clientCustomerId>
                  <ns2:developerToken>REDACTED</ns2:developerToken>
                      <ns2:userAgent>REDACTED (AwApi-PHP, googleads-php-lib/29.0.0, PHP/5.6.30-10+deb.sury.org~precise+2)</ns2:userAgent>
                    <ns2:validateOnly>false</ns2:validateOnly>
                     <ns2:partialFailure>false</ns2:partialFailure>
         </ns1:RequestHeader>
   </SOAP-ENV:Header>
     <SOAP-ENV:Body>
        <ns1:get>
                      <ns1:selector>
                         <ns1:searchParameters xsi:type="ns1:RelatedToQuerySearchParameter">
                                    <ns1:queries>google.com</ns1:queries>
                                  <ns1:queries>facebook.com</ns1:queries>
                                <ns1:queries>tiwtter.com</ns1:queries>
                         </ns1:searchParameters>
                        <ns1:searchParameters xsi:type="ns1:NetworkSearchParameter">
                                   <ns1:networkSetting>
                                           <ns2:targetGoogleSearch>true</ns2:targetGoogleSearch>
                                          <ns2:targetSearchNetwork>false</ns2:targetSearchNetwork>
                                       </ns1:networkSetting>
                          </ns1:searchParameters>
                        <ns1:ideaType>KEYWORD</ns1:ideaType>
                           <ns1:requestType>STATS</ns1:requestType>
                               <ns1:requestedAttributeTypes>KEYWORD_TEXT</ns1:requestedAttributeTypes>
                        <ns1:requestedAttributeTypes>SEARCH_VOLUME</ns1:requestedAttributeTypes>
                               <ns1:requestedAttributeTypes>AVERAGE_CPC</ns1:requestedAttributeTypes>
                         <ns1:requestedAttributeTypes>COMPETITION</ns1:requestedAttributeTypes>
                         <ns1:paging>
                                   <ns2:startIndex>0</ns2:startIndex>
                                     <ns2:numberResults>500</ns2:numberResults>
                             </ns1:paging>
                  </ns1:selector>
        </ns1:get>
     </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


response:

[Google\AdsApi\AdWords\v201708\cm\ApiException]
[RateExceededError <rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30>]

<soap:Envelope
<soap:Header>
<ResponseHeader
<ns2:requestId>REDACTED</ns2:requestId>
<ns2:serviceName>TargetingIdeaService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>45</ns2:responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[RateExceededError &lt;rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30&gt;]</faultstring>
<detail>
<ApiExceptionFault
<ns2:message>[RateExceededError &lt;rateName=RATE_LIMIT, rateKey=null, rateScope=ACCOUNT, retryAfterSeconds=30&gt;]</ns2:message>
<ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
<ns2:errors
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RateExceededError">
<ns2:fieldPath></ns2:fieldPath>
<ns2:trigger></ns2:trigger>
<ns2:errorString>RateExceededError.RATE_EXCEEDED</ns2:errorString>
<ns2:ApiError.Type>RateExceededError</ns2:ApiError.Type>
<ns2:reason>RATE_EXCEEDED</ns2:reason>
<ns2:rateName>RATE_LIMIT</ns2:rateName>
<ns2:rateScope>ACCOUNT</ns2:rateScope>
<ns2:retryAfterSeconds>30</ns2:retryAfterSeconds>
</ns2:errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>


I would like to be able to do the migration before the old API sunset.

Thank you.

Shwetha Vastrad (AdWords API Team)

unread,
Sep 25, 2017, 5:22:25 PM9/25/17
to AdWords API Forum
Hi Alejandro, 

It looks like you encountered the RateExceededError for exceeding the rate limit across Account rate scope. This rate limit is metered on all requests to a single AdWords account - no matter which developer token was used to make the request. There isn't a fixed queries per second limit in AdWords API. It fluctuates based on various factors including server load. This limit is applied to all requests made against a single AdWords account and the AdWords API Server may return a RateExceededError for exceeding rate limit within the Account scope. You'll need to wait for the amount of time specified in the retryAfterSeconds parameter before retrying. You'll need to implement some of the strategies listed here to handle RateExceededErrors. Please note that new AdWords accounts may have a significantly more restrictive rate limit (i.e., lower QPS) than established accounts, which is relaxed once the account has published ads.

If you consistently encounter RateExceededError with v201708 version of AdWords API, please provide the SOAP request and response logs and the MCC ID associated with your developer token so I can take a look. Please use Reply privately to author when responding. 

Regards,
Shwetha, AdWords API Team.

Alejandro Claure

unread,
Sep 28, 2017, 7:25:54 PM9/28/17
to AdWords API Forum
I was able to solve this problem by implementing better control in the number of calls my web app mas doing to the API.
Reply all
Reply to author
Forward
0 new messages