Internal API error while Mutating BiddingStrategy

68 views
Skip to first unread message

João Aparício

unread,
Mar 15, 2015, 12:37:51 PM3/15/15
to adwor...@googlegroups.com
Hi there,

This is happening some times:

        Server raised fault: 'InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro'

The python code is

        adgroup_service = client.GetService('AdGroupService', version='v201409')
        adgroup_operations = [{
                     'operator':'SET',
                     'operand': {
                        'xsi_type':'AdGroup',
                        'id':adgroupid,
                        'biddingStrategyConfiguration': {
                          'biddingStrategyId': strategy_id
                        }
                     }
                    } for text_sorted,acc_id,adgroupid,kw_id in chunk]
        logger.info('%s %s mutating bidstrategy %s operations' % (n,acc_id,len(adgroup_operations)) )
        r = adgroup_service.mutate(adgroup_operations)

The things that is strange here is the following:

A) Whether this code throws an error or not depends on the account. For some accounts it always throws an error, for other accounts it never throws an error.
B) For the accounts where an error is thrown, most of the times the adgroup biddingstrategies ARE mutated! My issue here is that mutates where an error is thrown are really slow (I assume due to some sort of internal timeout?)

Some guidance would be very useful.

Best,
Joao

Josh Radcliff (AdWords API Team)

unread,
Mar 15, 2015, 7:54:09 PM3/15/15
to adwor...@googlegroups.com
Hi Joao,

An UNEXPECTED_INTERNAL_API_ERROR is, as you suspected, often due to a timeout occurring while we process your request.

As a general rule, you should implement error handling and retry logic as specified in our best practices guide, since timeouts of this sort are bound to happen eventually on a small percentage of requests. Usually retrying such a request after waiting a few seconds will result in a successful request.

Thanks,
Josh, AdWords API Team

João Aparício

unread,
Mar 16, 2015, 11:31:11 AM3/16/15
to adwor...@googlegroups.com
Hi Josh,

No, that doesn't work. The unexpected_internal_api_error happens repeatedly (even though, like I said, some times the bidding strategy IS changed even though an error is thrown), and retrying doesn't help.

What did help was lowering the number of operations in the mutate chunk from 500 to 100. Now it seems to be going on without errors.

Thanks for your help.

Josh Radcliff (AdWords API Team)

unread,
Mar 16, 2015, 1:23:52 PM3/16/15
to adwor...@googlegroups.com
Hi,

Glad to hear that reducing the # of operations helped. You may also want to consider grouping operations as specified in the best practices guide, if you are not already doing so.

Thanks,
Josh, AdWords API Team

João Aparício

unread,
Mar 16, 2015, 2:05:05 PM3/16/15
to adwor...@googlegroups.com
Hi again Josh,

Are you saying that even though those operations target a certain AdGroupId, grouping together adgroups that belong to the same campaign is faster?

Josh Radcliff (AdWords API Team)

unread,
Mar 16, 2015, 5:06:41 PM3/16/15
to adwor...@googlegroups.com
Hi,

Sorry, I forgot you're already targeting by ad group. In that case, there's no need to worry about campaign-level batching since an ad group only exists in one campaign.

Thanks,
Josh, AdWords API Team

João Aparício

unread,
Mar 17, 2015, 1:31:54 PM3/17/15
to adwor...@googlegroups.com
Alright thanks :-)
Reply all
Reply to author
Forward
0 new messages