Update Campaign's the landing page using Python

22 views
Skip to first unread message

George Takla

unread,
Dec 14, 2022, 3:09:43 PM12/14/22
to Google Ads API and AdWords API Forum
Hi, I was able to update the campaign status with the guide of samples in github (I posted the code below)

I am trying to update the landing page, I tried campaign.url, and campaign.final_urls, etc.. but those generated error "Unknown field for Campaign".  I searched the API documentation and the web, without any luck. 

thanks for the help -george
'''
def update_campaign(client, customer_id, campaign_id, new_status):
campaign_service = client.get_service("CampaignService")
# Create campaign operation.
campaign_operation = client.get_type("CampaignOperation")
campaign = campaign_operation.update

campaign.resource_name = campaign_service.campaign_path(
customer_id, campaign_id
)

#campaign.status = client.enums.CampaignStatusEnum.PAUSED
campaign.status = new_status

# campaign.network_settings.target_search_network = False
# Retrieve a FieldMask for the fields configured in the campaign.
client.copy_from(
campaign_operation.update_mask,
protobuf_helpers.field_mask(None, campaign._pb),
)

campaign_response = campaign_service.mutate_campaigns(
customer_id=customer_id, operations=[campaign_operation]
)
'''

Google Ads API Forum Advisor

unread,
Dec 14, 2022, 8:18:56 PM12/14/22
to george...@dexcarehealth.com, adwor...@googlegroups.com
Hi George,

Thank you for reaching out to us.

For our team to further investigate and validate why you encountered an error, could you please provide us with the complete API logs (request and response with request-id) generated on your end? Note that this can be requested or provided to the developer handling the Google Ads API transactions when logging of the API requests has been enabled.

This is the specific guideline to enable Python - https://developers.google.com/google-ads/api/docs/client-libs/python/logging

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


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