Can someone help me and explain, maybe something is wrong with hierarchy or 
account settings for client accounts? How I can avoid this error (main idea 
to operate with Manager account and post ads from it client accounts). Also 
I can attach request_id for proper investigation if it is not obvious.

Thanks in advance!

четверг, 14 апреля 2022 г. в 12:27:27 UTC+3, Andrew Hrimov: 

> As I found else, not all my customers from Test Manager B can create 
> campaign too, for example, my manager customer_id 745-648-6668 has 3 client 
> accounts:
> 757-944-3809 <(757)%20944-3809>, 731-759-4472 <(731)%20759-4472>, 
> 226-977-9954 <(226)%20977-9954>. And campaign creation request fails just 
> with the last one client customer_id. Can you explain, what I'm doing 
> wrong, login_customer_id is passed (my manager account customer_id that has 
> access (from UI panel *Tools & settings -> Access & Security -> Managers*
> ).
> Thanks again!
>
> четверг, 14 апреля 2022 г. в 10:03:16 UTC+3, Andrew Hrimov: 
>
>> Hello everyone, I'm developing application in Django and using client 
>> library for GoogleAds (google-ads). I have Manager account A for first 
>> email, and Test Manager account B with some Test Client accounts, testing 
>> was OK (using Web-app flow, retrieve refresh token and operate with Test 
>> Manager account B, using developer token from Manager account A).
>>
>> Problem appeared, when I tried to access to another Test Manager account 
>> C with some customers, I have such error 
>> *errors {*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *  error_code {    operation_access_denied_error: 
>> CREATE_OPERATION_NOT_PERMITTED  }  message: "Unauthorized CREATE operation 
>> in invoking a service\'s mutate method."  trigger {    string_value: 
>> "DISPLAY_SMART_CAMPAIGN"  }  location {    field_path_elements {      
>> field_name: "operations"      index: 0    }    field_path_elements {      
>> field_name: "create"    }    field_path_elements {      field_name: 
>> "advertising_channel_sub_type"    }*
>>
>> *  }}*
>>
>> Accessing account B with it customers did not cause that error, I decided 
>> that smith wrong with customers on Test Manager account C, because I have 
>> added Test Client from account B and it worked. Can you help me with that?
>> Runnable code
>> *...*
>>
>>
>>
>>
>>
>>
>> *budget_resource_name = create_campaign_budget( client=client, 
>> customer_id=customer_id, campaign=campaign)campaign_resource_name = 
>> create_campaign( client=client, customer_id=customer_id, campaign=campaign, 
>> budget_name=budget_resource_name)*
>> *...*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *def create_campaign_budget(client, customer_id: str, campaign: 
>> Campaign): """Adds a campaign budget to the given client account. Args: 
>> client: an initialized GoogleAdsClient instance. customer_id: a client 
>> customer ID str. campaign: campaign instance (model) Returns: A str of the 
>> resource name for the newly created campaign budget. """ 
>> campaign_budget_operation = client.get_type("CampaignBudgetOperation") 
>> campaign_budget = campaign_budget_operation.create campaign_budget.name 
>> <http://campaign_budget.name> = f'CampaignBudget for Campaign #{campaign.pk 
>> <http://campaign.pk>}' campaign_budget.amount_micros = 
>> int(campaign.daily_budget * 10_000 * 100) campaign_budget.delivery_method = 
>> ( client.enums.BudgetDeliveryMethodEnum.STANDARD ) 
>> campaign_budget.explicitly_shared = False campaign_budget_service = 
>> client.get_service("CampaignBudgetService") response = 
>> campaign_budget_service.mutate_campaign_budgets( customer_id=customer_id, 
>> operations=[campaign_budget_operation] ) resource_name = 
>> response.results[0].resource_name campaign.google_budget_id = 
>> resource_name.split('/')[-1] campaign.save() return resource_name*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *def create_campaign(client, customer_id: str, campaign: Campaign, 
>> budget_name: str): """Adds a Display campaign to the given client account 
>> using the given budget. Args: client: an initialized GoogleAdsClient 
>> instance. customer_id: a client customer ID str. campaign: campaign 
>> instance (model) budget_name: the resource name str for a campaign budget. 
>> Returns: A str of the resource name for the newly created campaign. """ 
>> google_campaign_service = client.get_service("CampaignService") 
>> google_campaign_operation = client.get_type("CampaignOperation") 
>> google_campaign = google_campaign_operation.create google_campaign.name 
>> <http://google_campaign.name> = f'{campaign.name <http://campaign.name>} 
>> #{campaign.pk <http://campaign.pk>}' # must be unique so add pk to name 
>> advertising_channel_type_enum = client.enums.AdvertisingChannelTypeEnum 
>> google_campaign.advertising_channel_type = 
>> advertising_channel_type_enum.DISPLAY advertising_channel_sub_type_enum = ( 
>> client.enums.AdvertisingChannelSubTypeEnum ) # Smart Display campaign 
>> requires the advertising_channel_sub_type as # "DISPLAY_SMART_CAMPAIGN". 
>> google_campaign.advertising_channel_sub_type = ( 
>> advertising_channel_sub_type_enum.DISPLAY_SMART_CAMPAIGN ) status_enum = 
>> client.enums.CampaignStatusEnum if config('GOOGLE_STATUS_AD') == 'ENABLED': 
>> google_campaign.status = status_enum.ENABLED else: google_campaign.status = 
>> status_enum.PAUSED # Smart Display campaign requires the TargetCpa bidding 
>> strategy. google_campaign.maximize_conversions.target_cpa = False 
>> google_campaign.campaign_budget = budget_name # Target: Presence for 
>> geotargeting presence_pos_type = 
>> client.enums.PositiveGeoTargetTypeEnum.PRESENCE 
>> google_campaign.geo_target_type_setting.positive_geo_target_type = 
>> presence_pos_type # Run dates date_format = '%Y%m%d' start_date, end_date = 
>> campaign.start_date, campaign.end_date google_campaign.start_date = 
>> start_date.strftime(date_format) google_campaign.end_date = 
>> end_date.strftime(date_format) google_campaign_response = 
>> google_campaign_service.mutate_campaigns( customer_id=customer_id, 
>> operations=[google_campaign_operation] ) resource_name = 
>> google_campaign_response.results[0].resource_name*
>>
>> Interesting that throws error campaign creation, budget creation is OK. 
>> Thanks in advance, any help will be appreciated.
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/78b8ab40-7091-4143-8c2d-b8a781719286n%40googlegroups.com.

Reply via email to