Unexpected biddingStrategy configuration return type

732 views
Skip to first unread message

Stefano Fontana

unread,
Jul 4, 2016, 4:42:43 AM7/4/16
to AdWords API Forum
Hi, 

I'm using googleads 3.15.0 (v201603) with python to send the following operation which enables one AdGroup which has "Ad group bids (Auto) " as bid:

AdGroupOperation': [{u'operator': u'SET', u'operand': {u'status': u'ENABLED', u'id': u'3882381859', u'xsi_type': u'AdGroup'}


As a result I get back:

OrderedDict([(u'result', OrderedDict([(u'AdGroup', OrderedDict([(u'id', u'3882381859'), (u'campaignId', u'15923719'), (u'campaignName', u'[a:Rico_S&C_DE][n:GSN][l:DE][c:Kleidung&Accessoires_Product][k:k]'), (u'name', u'Kleidung:Boss_Orange'), (u'status', u'ENABLED'), (u'settings', [OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'TargetingSetting'), (u'Setting.Type', u'TargetingSetting'), (u'details', [OrderedDict([(u'criterionTypeGroup', u'USER_INTEREST_AND_LIST'), (u'targetAll', u'true')]), OrderedDict([(u'criterionTypeGroup', u'VERTICAL'), (u'targetAll', u'false')]), OrderedDict([(u'criterionTypeGroup', u'GENDER'), (u'targetAll', u'false')]), OrderedDict([(u'criterionTypeGroup', u'AGE_RANGE'), (u'targetAll', u'true')]), OrderedDict([(u'criterionTypeGroup', u'PLACEMENT'), (u'targetAll', u'false')]), OrderedDict([(u'criterionTypeGroup', u'PARENT'), (u'targetAll', u'false')])])]), OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'ExplorerAutoOptimizerSetting'), (u'Setting.Type', u'ExplorerAutoOptimizerSetting'), (u'optIn', u'false')])]), (u'labels', [OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'TextLabel'), (u'id', u'425651059'), (u'name', u'pausiert (22.01.2016)'), (u'status', u'ENABLED'), (u'attribute', OrderedDict([(u'@xsi:type', u'DisplayAttribute'), (u'LabelAttribute.Type', u'DisplayAttribute'), (u'backgroundColor', u'#99FFFF')])), (u'Label.Type', u'TextLabel')]), OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'TextLabel'), (u'id', u'241157539'), (u'name', u'processed_by_script'), (u'status', u'ENABLED'), (u'attribute', OrderedDict([(u'@xsi:type', u'DisplayAttribute'), (u'LabelAttribute.Type', u'DisplayAttribute'), (u'backgroundColor', u'#990000')])), (u'Label.Type', u'TextLabel')])]), (u'biddingStrategyConfiguration', OrderedDict([(u'biddingStrategyId', u'1358124216'), (u'biddingStrategyName', u'Kleidung & Accessoire'), (u'biddingStrategyType', u'TARGET_ROAS'), (u'biddingStrategySource', u'CAMPAIGN'), (u'bids', OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'CpcBid'), (u'Bids.Type', u'CpcBid'), (u'bid', OrderedDict([(u'ComparableValue.Type', u'Money'), (u'microAmount', u'40000')])), (u'cpcBidSource', u'ADGROUP')]))]))]))])), (u'index', u'0')])



where the biddingStrategyConfiguration.bids is: 

result['biddingStrategyConfiguration']['bids']

OrderedDict([(u'@xmlns:xsi', u'http://www.w3.org/2001/XMLSchema-instance'), (u'@xsi:type', u'CpcBid'), (u'Bids.Type', u'CpcBid'), (u'bid', OrderedDict([(u'ComparableValue.Type', u'Money'), (u'microAmount', u'40000')])),


which is a dictionary and not an array as indicated here https://developers.google.com/adwords/api/docs/reference/v201605/AdGroupService.BiddingStrategyConfiguration#bids

Is this a bug?


Please find attached the suds logs.



Ps:

Somewhat related - I have a simular issue when getting back the results from a job:

""""

response = batch_job_helper.ParseResponse(response_xml)


resp = response['mutateResponse']['rval']





if isinstance(resp, dict):  # Expecting an array but sometimes we get a dict!


    resp = [resp]

""""


bid_dict_issues.log

Shwetha Vastrad (AdWords API Team)

unread,
Jul 6, 2016, 2:51:35 PM7/6/16
to AdWords API Forum
Hi Stefano,

The ParseResponse method of the batch_job_helper object internally converts the XML response to dict in the Python client library. This method returns an OrderedDict containing the Batch Job Service Response. 

The format listed in the reference document is how the Bids will be available in the SOAP XML response. 

Regards,
Shwetha, AdWords API Team.

Stefano Fontana

unread,
Jul 7, 2016, 2:50:30 AM7/7/16
to AdWords API Forum
Hello Shwetha,

Yes, the problem is exactly the OrderedDict being returned. Here it says it's a list https://developers.google.com/adwords/api/docs/reference/v201605/AdGroupService.BiddingStrategyConfiguration#bids
So one of the two must be wrong. Which one is it? :)

Best,
   Stefano-

Shwetha Vastrad (AdWords API Team)

unread,
Jul 7, 2016, 1:05:45 PM7/7/16
to AdWords API Forum
Hi Stefano,

The SOAP XML response will contain the Bids as a list. This XML response is then parsed using the xmltodict Python module in the Python client library, which converts the list to an OrderedDict. 
Reply all
Reply to author
Forward
0 new messages