Hello, It looks like you are nesting one too many maps deep. You shouldn't need to explicitly set the :xsi_type of the AdGroupCriterionOperation, since there's only one type of operation accepted by the AdGroupCriterionService.
Notice how your :operand in the operation variable also has an :operand specified. Try this: ad_group_criterion = { :xsi_type => 'BiddableAdGroupCriterion', :ad_group_id => 'xxxxxx', :criterion => { :xsi_type => 'Keyword', :match_type => 'BROAD', :id => 'xxxxxx' } } operation = { :operator => 'ADD', :operand => ad_group_criterion } Regards, Mike, AdWords API Team On Wednesday, June 24, 2015 at 10:17:37 AM UTC-4, Johnny wrote: > > I'm trying to create an experiment via the API using the ruby client > library. Creating the experiment works ok but when I try to add a keyword I > get: > > /home/johnny/.rvm/gems/ruby-2.1.6/gems/google-ads-common-0.9.8/lib/ads_common/savon_service.rb:113:in > > `handle_errors': Unknown exception with error: Unmarshalling Error: > cvc-elt.4.3: Type 'AdGroupCriterionOperation' is not validly derived from > the type definition, 'AdGroupCriterion', of element 'operand'. > (AdsCommon::Errors::ApiException) > from > /home/johnny/.rvm/gems/ruby-2.1.6/gems/google-ads-common-0.9.8/lib/ads_common/savon_service.rb:83:in > > `execute_action' > from > /home/johnny/.rvm/gems/ruby-2.1.6/gems/google-adwords-api-0.13.2/lib/adwords_api/v201409/ad_group_criterion_service.rb:25:in > > `mutate' > from ../adwords_play.rb:52:in `<main>' > > Any ideas why? The relevant part of my code follows. > > ad_group_criterion_srv = adwords.service(:AdGroupCriterionService, > API_VERSION) > ad_group_criterion = { > :xsi_type => 'AdGroupCriterionOperation', > :operand => { > :xsi_type => 'BiddableAdGroupCriterion', > :ad_group_id => 'xxxxxx', > :criterion => { > :xsi_type => 'Keyword', > :match_type => 'BROAD', > :id => 'xxxxxx' > } > } > } > operation = { > :operator => 'ADD', > :operand => ad_group_criterion > } > > # Update criterion. > response = ad_group_criterion_srv.mutate([operation]) > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/9586fc46-432b-4b2b-aa47-a002ca7d1556%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.