Hi Team, 

I want to set my campaign's bid strategy to Target CPA but I am getting 
following error. Could you please help me on it? 
FaultMessage: The operation is not allowed for the given context.
Request with ID '****' failed with status 'INVALID_ARGUMENT' and includes 
the following errors:
        Error with message 'The operation is not allowed for the given 
context.'.

please find the code below
campaign_service = client.get_service("CampaignService")
campaign_operation = client.get_type("CampaignOperation")
campaign = campaign_operation.update
campaign.resource_name = campaign_resource_name
campaign.bidding_strategy_type = (
client.enums.BiddingStrategyTypeEnum.TARGET_CPA
)
campaign.target_cpa.target_cpa_micros = 35000000

# Set the update mask.
client.copy_from(
campaign_operation.update_mask,
protobuf_helpers.field_mask(None, campaign._pb),
)

try:
# Issue a mutate request to update the campaign.
campaign_response = campaign_service.mutate_campaigns(
customer_id=account.id, operations=[campaign_operation]
)

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ba3171d6-d70a-48b2-b9c1-fd373b8afd00n%40googlegroups.com.
  • Setting bi... 'Yigitalp (Alp) Korpe' via Google Ads API and AdWords API Forum

Reply via email to