Remove a bid from adgroup

105 views
Skip to first unread message

Pierre Riandey

unread,
Dec 6, 2021, 5:44:54 AM12/6/21
to AdWords API and Google Ads API Forum
Hello,
I am using the python client library for google ads API. In the documentation, to remove a bid it's specified to update the field to null (

But the client doesn't let met set the value for AdGroupCriterionOperation.update.cpc_bid_micros to something else than an integer.
And thus the bid is not removed.

If anyone has some hints on how to proceed, I'm currently searching through examples in the client library, but nothing I tried is working.

Thank a lot !

Mat

unread,
Dec 6, 2021, 6:30:15 AM12/6/21
to AdWords API and Google Ads API Forum
Hi Pierre,

this should work:

                        ad_group_criterion_operation = googleads_client.get_type(
                            'AdGroupCriterionOperation'
                        )
                        googleads_client.copy_from(
                            ad_group_criterion_operation.update_mask, field_mask
                        )
                        ad_group_criterion_operation.update_mask.paths.append(
                            'cpc_bid_micros'
                        )

Regards
Mat

Mat

unread,
Dec 6, 2021, 6:32:47 AM12/6/21
to AdWords API and Google Ads API Forum
sorry, forgot to copy 2 lines of code in between:

                        ad_group_criterion_operation = googleads_client.get_type(
                            f'AdGroupCriterionOperation'
                        )
                        ad_group_criterion = ad_group_criterion_operation.update
                        ad_group_criterion.resource_name = (
                            f"customers/{customer_id}/adGroupCriteria/"
                            f"{ad_group_id}~{criterion_id}"
                        )
                        googleads_client.copy_from(
                            ad_group_criterion_operation.update_mask, field_mask
                        )
                        ad_group_criterion_operation.update_mask.paths.append(
                            'cpc_bid_micros'
                        )

Regards
Mat

Pierre Riandey

unread,
Dec 6, 2021, 6:58:45 AM12/6/21
to AdWords API and Google Ads API Forum
Hey Mat,
Thank you  a lot, your solution worked like a charm !
Regards,
Pierre

Google Ads API Forum Advisor

unread,
Dec 6, 2021, 9:56:23 PM12/6/21
to p...@advertio.com, adwor...@googlegroups.com
Hi everyone,

Glad to hear that Mat's recommendation helped resolve your concern.

Should you have additional clarifications, let us know so our API team can assist further.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ScKsY:ref
Reply all
Reply to author
Forward
0 new messages