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])