If I don't specify bidding strategy for a campaign, I get an error that it 
is required:
-------------------------------------------------------------------------
 error_code {
    field_error: REQUIRED
  }
  message: "The required field was not present."
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "campaign_bidding_strategy"
    }
  }
}
-------------------------------------------------------------------------

But if I do, like so:
-------------------------------------------------------------------------
      String bidStrategyResName = null;
      try (BiddingStrategyServiceClient bidStrategySvcCli =
          googleClient.createBiddingStrategyServiceClient()) {

        BiddingStrategy bidStrategy =
            BiddingStrategy.newBuilder().setName("bidding_strategy_123")
                
.setTargetCpa(TargetCpa.newBuilder().setTargetCpaMicros(10000L).build()).build();
        BiddingStrategyOperation operation =
            
BiddingStrategyOperation.newBuilder().setCreate(bidStrategy).build();
        MutateBiddingStrategiesResponse response =
            bidStrategySvcCli.mutateBiddingStrategies(customerId, 
Arrays.asList(operation));
        MutateBiddingStrategyResult bidStrategyResult = 
response.getResults(0);
        bidStrategyResName = bidStrategyResult.getResourceName();
      }

      List<CampaignOperation> campaignOps = new ArrayList<>(1);
      Campaign googleCampaign = null;
      try (CampaignServiceClient campaignServiceClient =
          googleClient.createCampaignServiceClient()) {
        googleCampaign = Campaign.newBuilder().setName("campaign_123")
            .setAdvertisingChannelType(AdvertisingChannelType.MULTI_CHANNEL)
            
.setAdvertisingChannelSubType(AdvertisingChannelSubType.APP_CAMPAIGN)
            .setStatus(CampaignStatus.PAUSED)
            .setBiddingStrategy(bidStrategyResName)
            .setCampaignBudget(budgetResName)
            .build();

        CampaignOperation campaignOp =
            
CampaignOperation.newBuilder().setCreate(googleCampaign).build();
        campaignOps.add(campaignOp);

        MutateCampaignsResponse campaignResponse =
            campaignServiceClient.mutateCampaigns(customerId, campaignOps);
-------------------------------------------------------------------------

I get a different error:
-------------------------------------------------------------------------
 errors {
  error_code {
    operation_access_denied_error: OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE
  }
  message: "This operation is not permitted on this campaign type"
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "bidding_strategy"
    }
  }
}
-------------------------------------------------------------------------
I am setting it to TARGET_CPA because it says in the doc for app campaigns 
<https://developers.google.com/adwords/api/docs/guides/mobile-app-campaigns>  
that "Only the TARGET_CPA bidding strategy type is supported". (Though this 
same doc also says to use UNIVERSAL_APP_CAMPAIGN as subtype 
<https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService.Campaign#advertisingchannelsubtype>
 
but it does not seem to appear in AdvertisingChannelSubType enum 
<https://developers.google.com/google-ads/api/reference/rpc/v6/AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType>
  
(anymore?)

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c92e5fff-afee-4ee6-9b5e-4ce8e127a765n%40googlegroups.com.

Reply via email to