Hi, so I am using pything libary and the code I use is below. 
The question I ask that highlights this line : updated_agc.status.name = 
row['Keyword Status']

Sample df_input will be pandas data frame with column: Ad Group ID, Keyword 
ID, Keyword Status

def get_keyword_status_operations(client, customer_id, df_input):
    operations = []
    for index, row in df_input.iterrows():
        # resource name 
customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}
        agc_operation = client.get_type("AdGroupCriterionOperation")
        updated_agc = agc_operation.update
        updated_agc.resource_name = agc_service.ad_group_path(
        customer_id, row['Ad Group ID'], row['Keyword ID'])
        
        updated_agc.status.name = row['Keyword Status']
        client.copy_from(
            agc_operation.update_mask,
            protobuf_helpers.field_mask(None, updated_agc._pb))
        
        operations.append(ad_group_operation)
    return operations 

# running operations
agc_service = client.get_service("AdGroupCriterionService")
    while len(operations)>0:
    cur_operations = operations[0:500]
    print(cur_operations)
    agc_response = agc_service.mutate_ad_group_criteria(
        customer_id=customer_id,
        operations=[cur_operations],)
    operations = operations[500:]


Thank you!
On Thursday, March 24, 2022 at 6:11:04 PM UTC-7 adsapi wrote:

> Hi,
>
> Thank you for the reply. I am also a member of the Google Ads API team and 
> let me provide support to your concern.
>
> Please see my answer below for each question:
>
> "
>
> *Q: for changing ad_group_criterion_status, is this operation correct? Do 
> I miss any parameter for updated ad_group_criterion.status? I found that in 
> sample code, if I want to update a campaign. I need to set campaign.status 
> to PAUSE. *"
> -The process of setting status of the campaign is identical with the ad 
> group criterion. The suggestion by my colleague seems to be applicable here 
> and you can perform a request using the 
> AdGroupCriterionService.MutateAdGroupCriteriaRequest 
> <https://developers.google.com/google-ads/api/reference/rpc/v10/MutateAdGroupCriteriaRequest?hl=en>
>  and 
> also while using the update 
> <https://developers.google.com/google-ads/api/reference/rpc/v10/AdGroupCriterionOperation?hl=en#update>
>  operation, 
> to pass an updated value for the status 
> <https://developers.google.com/google-ads/api/reference/rpc/v10/AdGroupCriterion?hl=en#status>
>  
> field.
>
>
>
>
>
> *Q. I found that in Enum doc. it can use .name to call the value. 
> Therefore, if I want to change the status by input file: I can use code 
> like : ad_group_criterion.status. name = 'ENABLED' ? My question is like 
> for the resource_path and field mask, it has a function to generate it to 
> list.  Is client.enums.AdGroupCriterionStatusEnum has some kind of 
> function?*
> -It appears that this question is code specific. With this, would you be 
> able to specify the client library that you are using here so that I can 
> route you to the author of the client library accordingly? The author of 
> the client library is more equipped to provide support to the code specific 
> and client library related concern.
>
> Regards,
> [image: Google Logo] 
> Ernie John 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2XmeLo: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 
"Google Ads API and AdWords 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/a0eda0b2-4158-407c-8274-6184b71133b8n%40googlegroups.com.
  • Re... jubap...@gmail.com
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... jubap...@gmail.com
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
          • ... jubap...@gmail.com
            • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
              • ... jubap...@gmail.com
              • ... jubap...@gmail.com
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
              • ... jubap...@gmail.com
              • ... jubap...@gmail.com

Reply via email to