Hi Nikisha, thanks for your reply!


Yes I’ve followed the guide. There is a code sample:

campaign_operation = ga_client.get_type('CampaignOperation', version='v2')
campaign = campaign_operation.create

campaign.name.value = 'Test API campaign'
campaign.advertising_channel_type = 
ga_client.get_type('AdvertisingChannelTypeEnum').MULTI_CHANNEL
campaign.advertising_channel_sub_type = 
ga_client.get_type('AdvertisingChannelSubTypeEnum').APP_CAMPAIGN
campaign.AppCampaignSetting.app_store = 
ga_client.get_type('AppCampaignAppStoreEnum').APPLE_APP_STORE
campaign.AppCampaignSetting.app_id = '123456789'
campaign.AppCampaignSetting.bidding_strategy_goal_type =\
    
ga_client.get_type('AppCampaignBiddingStrategyGoalTypeEnum').OPTIMIZE_INSTALLS_TARGET_INSTALL_COST
campaign.status = ga_client.get_type('CampaignStatusEnum', version='v2').PAUSED

campaign_budget_service = 
ga_client.get_service('CampaignBudgetService',version='v2')

campaign_budget_operation = ga_client.get_type('CampaignBudgetOperation',
                                                version='v2')
campaign_budget = campaign_budget_operation.create
campaign_budget.name.value = 'Test budget'
campaign_budget.delivery_method = ga_client.get_type(
    'BudgetDeliveryMethodEnum').STANDARD
campaign_budget.amount_micros.value = 500000
campaign_budget.explicitly_shared.value = False

# Add budget.
try:
    campaign_budget_response = (
        campaign_budget_service.mutate_campaign_budgets(
            test_id, [campaign_budget_operation]))
except google.ads.google_ads.errors.GoogleAdsException as ex:
    print('Request with ID "%s" failed with status "%s" and includes the '
          'following errors:' % (ex.request_id, ex.error.code().name))
    for error in ex.failure.errors:
        print('\tError with message "%s".' % error.message)
        if error.location:
            for field_path_element in error.location.field_path_elements:
                print('\t\tOn field: %s' % field_path_element.field_name)
    sys.exit(1)

campaign.campaign_budget.value = 
(campaign_budget_response.results[0].resource_name)

campaign_service = ga_client.get_service('CampaignService', version='v2')
campaign_response = campaign_service.mutate_campaigns(test_id, 
[campaign_operation])



If I run this code I’ve got an error:

{
  error_code {
    field_error: REQUIRED
  }
  message: "The required field was not present."
  trigger {
    string_value: ""
  }
  location {
    field_path_elements {
      field_name: "operations"
      index {
      }
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "campaign_bidding_strategy"
    }
  }
}


And if I add following code for bidding strategy and run:

campaign_bid_strategy_service = ga_client.get_service('BiddingStrategyService', 
version='v2')

campaign_bid_strategy_operation = 
ga_client.get_type('BiddingStrategyOperation', version='v2')

campaign_bid_strategy = campaign_bid_strategy_operation.create
campaign_bid_strategy.name.value = 'Test bid'
campaign_bid_strategy.type = 
ga_client.get_type('BiddingStrategyTypeEnum').TARGET_CPA
campaign_bid_strategy.target_cpa.target_cpa_micros.value = 50000

# Add bid.
try:
    campaign_bid_strategy_response = (
        campaign_bid_strategy_service.mutate_bidding_strategies(
            test_id, [campaign_bid_strategy_operation]))
except google.ads.google_ads.errors.GoogleAdsException as ex:
    print('Request with ID "%s" failed with status "%s" and includes the '
          'following errors:' % (ex.request_id, ex.error.code().name))
    for error in ex.failure.errors:
        print('\tError with message "%s".' % error.message)
        if error.location:
            for field_path_element in error.location.field_path_elements:
                print('\t\tOn field: %s' % field_path_element.field_name)
    sys.exit(1)

campaign.bidding_strategy.value = 
(campaign_bid_strategy_response.results[0].resource_name)


I’ve got another error:

{
  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 {
      }
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "bidding_strategy"
    }
  }
}


I understand that I’ve created portfolio bidding strategy, and I cannot use 
it with an app campaign, however I don’t know how to create simple bidding 
strategy. 

Thanks!

пятница, 18 октября 2019 г., 17:33:42 UTC+2 пользователь adsapiforumadvisor 
написал:
>
> Hi Dan,
>
> I understand you are having trouble while creating the App campaigns via 
> Google Ads API and to assist you better I would like a few confirmation 
> from your end. Could you please confirm if you have followed this 
> <https://developers.google.com/google-ads/api/docs/app-campaigns/create-campaign>
>  
> guide while creating the App Campaigns and you are not specifying 
> the portfolio bidding strategy for your campaign? The bidding strategy 
> types that are supported for these campaign types are listed in the 
> preparation section of the guide 
> <https://developers.google.com/google-ads/api/docs/app-campaigns/create-campaign#preparation>.
>  
> Could you please give this a try and let me know if you are still facing 
> this issue?
>
> Regards,
> Nikisha Patel, Google Ads API Team
>
>
> ref:_00D1U1174p._5001UKNjrT:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/9d4ef0fd-f342-4947-9ba5-fcc0e590a589%40googlegroups.com.

Reply via email to