CampaignBidModifierOperation not in _OPERATION_MAP

94 views
Skip to first unread message

wtemm...@cyberpublicity.com

unread,
Aug 29, 2018, 5:23:05 PM8/29/18
to AdWords API and Google Ads API Forum
Hi,

I tried to create a call bid adjustment with the API. So after reading the Adwords API and analyze data return by Adwords API.
The problem is :
I create my add operation but the CampaignBidModifierService doesn't have his CampaignBidModifierOperation present in _OPERATION_MAP (line 641) of googleads/adwords.py
So that raise a KeyError.

Stack error : 
~/projects/tool/lib/python3.5/site-packages/googleads/adwords.py in _GenerateRawRequestXML(self, operations)
    891         KeyError: If the given operation type is not supported.
    892       """
--> 893       operation = self._OPERATION_MAP[operations[0]['xsi_type']]
    894       service = self.client.GetService(operation.service, self._version)
    895       return service.GetRequestXML(operation.method, operations)

KeyError: 'CampaignBidModifierOperation'

Do you have an idea why this operation is not present in _OPERATION_MAP ?
And is it possible to create a call bid adjustement with API ? (it's possible by Google Ads website)

Regards,

Wilfried

Luis Xander Talag (AdWords API Team)

unread,
Aug 30, 2018, 1:31:34 AM8/30/18
to AdWords API and Google Ads API Forum
Hi Wilfried,

If you successfully downloaded and installed the Python client library, you should be able to see the operation as it is possible to adjust bid through the API. This being said, the possible issue here is specific to the Python client library rather than the AdWords API. I would suggest to post your issue here as the client library owners are better equipped to assist you.

Thanks and regards,
Luis
AdWords API Team

wtemm...@cyberpublicity.com

unread,
Aug 30, 2018, 8:10:32 AM8/30/18
to AdWords API and Google Ads API Forum
Hi Luis,

To keep this POST update, here the link of issue on github : https://github.com/googleads/googleads-python-lib/issues/320

Regards,

Wilfried

wtemm...@cyberpublicity.com

unread,
Aug 30, 2018, 1:40:13 PM8/30/18
to AdWords API and Google Ads API Forum
Hi Luis,

Some update, I was trying to use batchJobService with this service. But BatchJobService doesn't support CampaignBidModifier.
So I tried to update a campaign call bid adjustment without batchjob but I have a InternalApiError.UNEXPECTED_INTERNAL_API_ERROR.

Here my operation :
[
   
{
       
"xsi_type": "CampaignBidModifierOperation",
       
"operator": "SET"
       
"operand": {
           
"campaignId": 1535056550,
           
"criterion": {
               
"Criterion.Type": "InteractionType",
               
"id": 8000,
               
"type": "INTERACTION_TYPE"
           
},
           
"bidModifier": 2.5,
           
"xsi_type": "CampaignBidModifier"
       
},
   
}
]

And stack with error :
INFO 2018-08-30 13:37:18,365 util 16101 139867432646400 Request made: Service: "CampaignBidModifierService" Method: "mutate" URL: "https://adwords.google.com/api/adwords/cm/v201802/CampaignBidModifierService"
WARNING 2018-08-30 13:37:18,963 util 16101 139867432646400 Error summary: 
{
    "operations": "0",
    "methodName": "mutate",
    "faultMessage": "[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]",
    "requestId": "000574aa86ccbfc80a3773c6d7042898",
    "serviceName": "campaign_bid_modifier_service.CampaignBidModifierService",
    "responseTime": "558"
}
[InternalApiError.UNEXPECTED_INTERNAL_API_ERROR @ com.google.ads.api.services.common.error.InternalApiError.<init>(InternalApiErro]

Do you have any idea why I have go an InternalApiError ?

wtemm...@cyberpublicity.com

unread,
Aug 30, 2018, 2:21:17 PM8/30/18
to AdWords API and Google Ads API Forum
Here my SOAP content :

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
  <soap-env:Header>
    <ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201802">
      <ns0:clientCustomerId>476-128-0144</ns0:clientCustomerId>
      <ns0:developerToken>REDACTED</ns0:developerToken>
      <ns0:userAgent>Ads Python Client Library (AwApi-Python, googleads/11.0.1, Python/3.5.2, zeep)</ns0:userAgent>
      <ns0:validateOnly>false</ns0:validateOnly>
      <ns0:partialFailure>false</ns0:partialFailure>
    </ns0:RequestHeader>
  </soap-env:Header>
  <soap-env:Body>
      <ns0:operations>
        <ns0:operator>SET</ns0:operator>
        <ns0:operand>
          <ns0:campaignId>1535056550</ns0:campaignId>
          <ns0:criterion>
            <ns0:id>8000</ns0:id>
            <ns0:type>INTERACTION_TYPE</ns0:type>
            <ns0:Criterion.Type>InteractionType</ns0:Criterion.Type>
          </ns0:criterion>
          <ns0:bidModifier>2.5</ns0:bidModifier>
        </ns0:operand>
      </ns0:operations>
    </ns0:mutate>
  </soap-env:Body>
</soap-env:Envelope>

Luis Xander Talag (AdWords API Team)

unread,
Aug 30, 2018, 11:25:40 PM8/30/18
to AdWords API and Google Ads API Forum
Hi Wilfried,

Thank you for providing detailed information of your issue. Upon investigating and based on your SOAP request, you did not explicitly use or indicate the type of criterion which is the InteractionType which may have caused the InternalApiError.UNEXPECTED_INTERNAL_API_ERROR error. You may refer to below SOAP request for your reference.

        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201806">
            <operations>
                <operator>SET</operator>
                <operand>
                    <campaignId>1535056550</campaignId>
                    <criterion xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201806" xsi:type="ns2:InteractionType">
                        <ns2:id>8000</ns2:id>
                        <ns2:type>INTERACTION_TYPE</ns2:type>
                    </criterion>
                    <bidModifier>2.5</bidModifier>
                </operand>
            </operations>
        </mutate>

Let me know if it works.

Regards,
Luis
AdWords API Team 

wtemm...@cyberpublicity.com

unread,
Aug 31, 2018, 8:25:23 AM8/31/18
to AdWords API and Google Ads API Forum
Hi Luis,

Thank you for your time and your answer. I found my problem.
I based my operation on the answer receive by a get on API.
"criterion": {
 
"Criterion.Type": "InteractionType", # This line was not good. I should write "xsi_type": "InteractionType"

 
"id": 8000,
 
"type": "INTERACTION_TYPE"
},

Regards,


Wilfried
Reply all
Reply to author
Forward
0 new messages