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"
    }
  }
}


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/603da653-dbe1-4444-94f2-fd8f6b29c87a%40googlegroups.com.

Reply via email to