googleads / google-api-ads-ruby

Ad Manager SOAP API Client Libraries for Ruby
297 stars 227 forks source link

Cannot Assign Labels to AdGroupCriterion(Keyword) / AdGroupAd using BatchJobService #140

Closed agnel-waghela closed 6 years ago

agnel-waghela commented 6 years ago

According to the Google Adwords API Documentation, the AdGroupCriterionLabelOperation and AdGroupAdLabelOperation are supported in BatchJobService.

But when I'm trying to create a Keyword or an Ad and assign a label alongside with it in the same BatchJob request, the Keyword or Ad creation succeeds whereas the LabelOperation fails.

Below is a sample request and response for a Keyword

Request - Here a TempId is assigned to the AdGroupCriterionOperation since the AdGroupCriterionLabelOperation requires the id of the AdGroupCriterion to associate a label to it.

[{:xsi_type=>"AdGroupCriterionOperation",
  :operator=>"ADD",
  :operand=>
   {:xsi_type=>"BiddableAdGroupCriterion",
    :ad_group_id=>"50208085678",
    :criterion=>
     {:xsi_type=>"Keyword",
      :text=>"+1 +BHK +Apartment",
      :match_type=>"BROAD",
      :id=>-1},
    :bidding_strategy_configuration=>
     {:bids=>[{:xsi_type=>"CpcBid", :bid=>{:micro_amount=>13000000}}]}}},
 {:xsi_type=>"AdGroupCriterionLabelOperation",
  :operator=>"ADD",
  :operand=>
   {:ad_group_id=>"50208085678", :criterion_id=>-1, :label_id=>"2131330045"}}]

Response -

[{:result=>
   {:ad_group_criterion=>
     {:ad_group_id=>"50208085678",
      :criterion=>
       {:id=>"296137713990",
        :type=>"KEYWORD",
        :criterion_type=>"Keyword",
        :text=>"+1 +BHK +Apartment",
        :match_type=>"BROAD"},
      :ad_group_criterion_type=>"BiddableAdGroupCriterion",
      :user_status=>"ENABLED",
      :system_serving_status=>"ELIGIBLE",
      :approval_status=>"PENDING_REVIEW",
      :bidding_strategy_configuration=>
       {:bidding_strategy_type=>"MANUAL_CPC",
        :bidding_strategy_source=>"CAMPAIGN",
        :bidding_scheme=>
         {:bidding_scheme_type=>"ManualCpcBiddingScheme",
          :enhanced_cpc_enabled=>"false"},
        :bids=>
         [{:bids_type=>"CpcBid",
           :bid=>{:comparable_value_type=>"Money", :micro_amount=>"13000000"},
           :cpc_bid_source=>"CRITERION",
           :"@xsi:type"=>"CpcBid"},
          {:bids_type=>"CpmBid",
           :bid=>{:comparable_value_type=>"Money", :micro_amount=>"10000"},
           :cpm_bid_source=>"ADGROUP",
           :"@xsi:type"=>"CpmBid"}]}}},
  :index=>"0"},
 {:error_list=>
   {:errors=>
     {:field_path=>"operations[1].operand.criterionId",
      :field_path_elements=>
       [{:field=>"operations", :index=>"1"},
        {:field=>"operand"},
        {:field=>"criterionId"}],
      :trigger=>"TempCriterionId{id=1}",
      :error_string=>"EntityNotFound.INVALID_ID",
      :api_error_type=>"EntityNotFound",
      :reason=>"INVALID_ID"}},
  :index=>"1"}]
dklimkin commented 6 years ago

Hello @agnel-waghela,

This doesn't appear to be a library-specific ubg, but a general API issue. Could you please reach out to the support team on the forum instead? The team would be able to confirm the behavior for temp IDs for labels.

https://groups.google.com/forum/#!forum/adwords-api

Thank you.

agnel-waghela commented 6 years ago

Thanks @dklimkin, I have reached out to the Adwords API Team to confirm the Behaviour of Temp IDs.

Here is the Link to the thread for those who might encounter this in future.