Can not set trackingUrlTemplate for Biddable AdGroupCriterion

87 views
Skip to first unread message

Антон Сычугов

unread,
May 31, 2016, 7:35:49 AM5/31/16
to AdWords API Forum
When I get entities of AdGroupCriterion, I have entities with trackingUrlTemplate. But when I try to change trackingUrlTemplate, I've got error from suds: suds.TypeNotFound: Type not found: 'trackingUrlTemplate'
Example of entity:
(BiddableAdGroupCriterion){
   adGroupId = 2930....
   criterionUse = "BIDDABLE"
   criterion = 
      (Keyword){
         id = 1760......
         type = "KEYWORD"
         Criterion.Type = "Keyword"
         text = "аниматоры"
         matchType = "BROAD"
      }
   AdGroupCriterion.Type = "BiddableAdGroupCriterion"
   qualityInfo = 
      (QualityInfo){
         qualityScore = 7
      }
   trackingUrlTemplate = "{lpurl}?cm_id=1"
 }

Shwetha Vastrad (AdWords API Team)

unread,
May 31, 2016, 4:14:05 PM5/31/16
to AdWords API Forum
Hi,

The update_keyword Python example demonstrates how to update the attributes of a keyword. You can use that as a reference to make changes to an AdGroupCriterion. You can also use Suds Doctor module to fix broken schema(s). If you still see this problem, please provide the code you are using to update AdGroupCriterion.

Regards,
Shwetha, AdWords API Team.

Антон Сычугов

unread,
Jun 2, 2016, 12:59:33 PM6/2/16
to AdWords API Forum
I use service.mutate method for saving ad group criterion:
ops = [{
                    'operator': 'SET',
                    'operand': {
                        'adGroupId': groupId,
                        # 'xsi_type': 'BiddableAdGroupCriterion',
                        'criterion': {
                            'id': id
                        },
                        'trackingUrlTemplate': trackingUrlTemplate
                    }
           }]
service.mutate(ops)
And I getting suds.TypeNotFound: Type not found: 'xsi_type' if 'xsi_type': 'BiddableAdGroupCriterion', is uncommented and suds.TypeNotFound: Type not found: 'trackingUrlTemplate' if it is commented.
Could you provide any example of using suds Doctor for modifying wsdl?

вторник, 31 мая 2016 г., 23:14:05 UTC+3 пользователь Shwetha Vastrad (AdWords API Team) написал:

Shwetha Vastrad (AdWords API Team)

unread,
Jun 2, 2016, 2:51:05 PM6/2/16
to AdWords API Forum
Hi,

Can you confirm that you are using the AdGroupCriterionService? This is likely the case where the incorrect service is being used. Could you provide the output logs when you try to update the criterion? You can find the instruction to enable logging for the python client library here.

Thanks,
Shwetha, AdWords API Team.

Антон Сычугов

unread,
Jun 3, 2016, 3:36:57 AM6/3/16
to AdWords API Forum
Thanks a lot for quick response!
Yes, I'm using AdGroupCriterionService, API version 201601.

suds logs:
2016-06-03 10:30:58,683 DEBUG    suds.xsd.query: ('mutate', 'https://adwords.google.com/api/adwords/cm/v201601'), found as: <Element:0x7fe7349fa390 name="mutate" />
2016-06-03 10:30:58,683 DEBUG    suds.xsd.query: ('mutate', 'https://adwords.google.com/api/adwords/cm/v201601'), found as: <Element:0x7fe7349fa390 name="mutate" />
2016-06-03 10:30:58,684 DEBUG    suds.mx.core: processing:
(Content){
   tag = "operations"
   value = 
      {
         operand = 
            {
               trackingUrlTemplate = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
               adGroupId = ...
               criterion = 
                  {
                     id = ...
                  }
            }
         operator = "SET"
      }
   type = <Element:0x7fe7349fa6d8 name="operations" type="('AdGroupCriterionOperation', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   real = <Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation">
   <ComplexContent:0x7fe7343c22e8>
      <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
         <Sequence:0x7fe72fbd9048>
            <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
         </Sequence>
         <Sequence:0x7fe7343c2860>
            <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         </Sequence>
      </Extension>
   </ComplexContent>
</Complex>
 }
2016-06-03 10:30:58,684 DEBUG    suds.mx.core: appending parent:
<suds.sax.document.Document object at 0x7fe72fa9bd68>
content:
(Content){
   tag = "operations"
   value = 
      {
         operand = 
            {
               trackingUrlTemplate = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
               adGroupId = ...
               criterion = 
                  {
                     id = ...
                  }
            }
         operator = "SET"
      }
   type = <Element:0x7fe7349fa6d8 name="operations" type="('AdGroupCriterionOperation', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   real = <Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation">
   <ComplexContent:0x7fe7343c22e8>
      <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
         <Sequence:0x7fe72fbd9048>
            <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
         </Sequence>
         <Sequence:0x7fe7343c2860>
            <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         </Sequence>
      </Extension>
   </ComplexContent>
</Complex>
 }
2016-06-03 10:30:58,684 DEBUG    suds.mx.literal: starting content:
(Content){
   tag = "operations"
   value = 
      {
         operand = 
            {
               trackingUrlTemplate = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
               adGroupId = ...
               criterion = 
                  {
                     id = ...
                  }
            }
         operator = "SET"
      }
   type = <Element:0x7fe7349fa6d8 name="operations" type="('AdGroupCriterionOperation', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   real = <Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation">
   <ComplexContent:0x7fe7343c22e8>
      <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
         <Sequence:0x7fe72fbd9048>
            <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
         </Sequence>
         <Sequence:0x7fe7343c2860>
            <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         </Sequence>
      </Extension>
   </ComplexContent>
</Complex>
 }
2016-06-03 10:30:58,685 DEBUG    suds.resolver: push: (<suds.resolver.Frame object at 0x7fe72fa9be48>)
<suds.resolver.Frame object at 0x7fe72fa9be48>
2016-06-03 10:30:58,685 DEBUG    suds.mx.literal: created - node:
2016-06-03 10:30:58,685 DEBUG    suds.mx.core: appending parent:
content:
(Content){
   tag = "operator"
   value = "SET"
 }
2016-06-03 10:30:58,685 DEBUG    suds.mx.literal: starting content:
(Content){
   tag = "operator"
   value = "SET"
 }
2016-06-03 10:30:58,686 DEBUG    suds.resolver: searching parent (<Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation" />) for (operator)
2016-06-03 10:30:58,686 DEBUG    suds.xsd.sxbasic: Element:0x7fe72fbd9128, resolving: ('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')
 using:(TypeQuery){
   id = "TypeQuery:0x7fe72fbfb5c0"
   ref[] = 
      "Operator",
   history[] = 
      <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />,
   resolved = False
 }
2016-06-03 10:30:58,686 DEBUG    suds.xsd.query: ('Operator', 'https://adwords.google.com/api/adwords/cm/v201601'), found as: <Simple:0x7fe72faf4198 name="Operator" />
2016-06-03 10:30:58,686 DEBUG    suds.resolver: push: (<suds.resolver.Frame object at 0x7fe72fbfb550>)
<suds.resolver.Frame object at 0x7fe72fa9be48>
<suds.resolver.Frame object at 0x7fe72fbfb550>
2016-06-03 10:30:58,686 DEBUG    suds.mx.literal: created - node:
2016-06-03 10:30:58,686 DEBUG    suds.mx.literal: ending content:
(Content){
   tag = "operator"
   value = "SET"
   type = <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   real = <Simple:0x7fe72faf4198 name="Operator">
   <Restriction:0x7fe7349f6470 ref="('string', 'http://www.w3.org/2001/XMLSchema')">
      <Enumeration:0x7fe7349f64e0 name="ADD" />
      <Enumeration:0x7fe7349f6518 name="REMOVE" />
      <Enumeration:0x7fe7349f6550 name="SET" />
   </Restriction>
</Simple>
   ancestry[] = 
      <Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation">
   <ComplexContent:0x7fe7343c22e8>
      <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
         <Sequence:0x7fe72fbd9048>
            <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
         </Sequence>
         <Sequence:0x7fe7343c2860>
            <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
            <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         </Sequence>
      </Extension>
   </ComplexContent>
</Complex>,
      <ComplexContent:0x7fe7343c22e8>
   <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
      <Sequence:0x7fe72fbd9048>
         <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
      </Sequence>
      <Sequence:0x7fe7343c2860>
         <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
         <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
      </Sequence>
   </Extension>
</ComplexContent>,
      <Extension:0x7fe7343c2710 ref="('Operation', 'https://adwords.google.com/api/adwords/cm/v201601')">
   <Sequence:0x7fe72fbd9048>
      <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
      <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
   </Sequence>
   <Sequence:0x7fe7343c2860>
      <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />
      <Element:0x7fe7343c2a58 name="exemptionRequests" type="('ExemptionRequest', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   </Sequence>
</Extension>,
      <Sequence:0x7fe72fbd9048>
   <Element:0x7fe72fbd9128 name="operator" type="('Operator', 'https://adwords.google.com/api/adwords/cm/v201601')" />
   <Element:0x7fe72fbd9160 name="Operation.Type" type="('string', 'http://www.w3.org/2001/XMLSchema')" />
</Sequence>,
 }
2016-06-03 10:30:58,687 DEBUG    suds.resolver: pop: (<suds.resolver.Frame object at 0x7fe72fbfb550>)
<suds.resolver.Frame object at 0x7fe72fa9be48>
2016-06-03 10:30:58,687 DEBUG    suds.mx.core: appending parent:
   <tns:operator>SET</tns:operator>
</tns:operations>
content:
(Content){
   tag = "operand"
   value = 
      {
         trackingUrlTemplate = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
         adGroupId = ...
         criterion = 
            {
               id = ...
            }
      }
 }
2016-06-03 10:30:58,687 DEBUG    suds.mx.literal: starting content:
(Content){
   tag = "operand"
   value = 
      {
         trackingUrlTemplate = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
         adGroupId = ...
         criterion = 
            {
               id = ...
            }
      }
 }
2016-06-03 10:30:58,687 DEBUG    suds.resolver: searching parent (<Complex:0x7fe7349c1e80 name="AdGroupCriterionOperation" />) for (operand)
2016-06-03 10:30:58,687 DEBUG    suds.xsd.sxbasic: Element:0x7fe7343c2a20, resolving: ('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')
 using:(TypeQuery){
   id = "TypeQuery:0x7fe72fbfb780"
   ref[] = 
      "AdGroupCriterion",
   history[] = 
      <Element:0x7fe7343c2a20 name="operand" type="('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601')" />,
   resolved = False
 }
2016-06-03 10:30:58,687 DEBUG    suds.xsd.query: ('AdGroupCriterion', 'https://adwords.google.com/api/adwords/cm/v201601'), found as: <Complex:0x7fe7349c12b0 name="AdGroupCriterion" />
2016-06-03 10:30:58,687 DEBUG    suds.resolver: push: (<suds.resolver.Frame object at 0x7fe72fbfb128>)
<suds.resolver.Frame object at 0x7fe72fa9be48>
<suds.resolver.Frame object at 0x7fe72fbfb128>
2016-06-03 10:30:58,688 DEBUG    suds.mx.literal: created - node:
2016-06-03 10:30:58,688 DEBUG    suds.sudsobject: ['trackingUrlTemplate', 'adGroupId', 'criterion'] must be superset of [adGroupId, criterionUse, criterion, labels, forwardCompatibilityMap, AdGroupCriterion.Type], ordering ignored
2016-06-03 10:30:58,688 DEBUG    suds.mx.core: appending parent:
<tns:operand/>
content:
(Content){
   tag = "trackingUrlTemplate"
   value = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
 }
2016-06-03 10:30:58,688 DEBUG    suds.mx.literal: starting content:
(Content){
   tag = "trackingUrlTemplate"
   value = "{lpurl}?cm_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}"
 }
2016-06-03 10:30:58,688 DEBUG    suds.resolver: searching parent (<Complex:0x7fe7349c12b0 name="AdGroupCriterion" />) for (trackingUrlTemplate)

It seems that I have to defend inheritance some how.


четверг, 2 июня 2016 г., 21:51:05 UTC+3 пользователь Shwetha Vastrad (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Jun 3, 2016, 3:14:11 PM6/3/16
to AdWords API Forum
Hi,

I just tried to replicate the error you're encountering, but the request succeeds for me. In case it helps, here's what my modified update_keyword.py file looks like:

  operations = [{
      'operator': 'SET',
      'operand': {
          'adGroupId': ad_group_id,
          'xsi_type': 'BiddableAdGroupCriterion',
          'criterion': {
              'id': criterion_id,
          },
          'trackingUrlTemplate': '{lpurl}?c1m_id={campaignid}_{adgroupid}_{creative}_{targetid}_{device}_{adposition}_{network}_{placement}'
      }
  }]

Could you let me know which version of Python you're using, and which version of the Python client library you're using?

Thanks,
Josh, AdWords API Team

Антон Сычугов

unread,
Jun 6, 2016, 4:49:00 AM6/6/16
to AdWords API Forum
I work with python3.5.0, suds-jurko 0.6.
With your example I have:
suds.TypeNotFound: Type not found: 'xsi_type'

пятница, 3 июня 2016 г., 22:14:11 UTC+3 пользователь Josh Radcliff (AdWords API Team) написал:

Josh Radcliff (AdWords API Team)

unread,
Jun 6, 2016, 1:39:24 PM6/6/16
to AdWords API Forum
Hi,

Could you also let me know which version of googleads-python-lib you are using?

Thanks,
Josh, AdWords API Team

Антон Сычугов

unread,
Jun 6, 2016, 4:46:23 PM6/6/16
to AdWords API Forum
I do not use googleads-python-lib. I have suds-jurko wrapped by tons of legacy code.

понедельник, 6 июня 2016 г., 20:39:24 UTC+3 пользователь Josh Radcliff (AdWords API Team) написал:
Reply all
Reply to author
Forward
0 new messages