Python example of the Ad schedule mutation

67 views
Skip to first unread message

Juan Carlos Blanco Delgado

unread,
Nov 13, 2019, 4:57:06 AM11/13/19
to AdWords API and Google Ads API Forum
Hello, 

I was trying to find an example of how to edit/create/delete an ad schedule of a campaign. 

Thank you!!!

Google Ads API Forum Advisor Prod

unread,
Nov 13, 2019, 12:11:57 PM11/13/19
to juancarlos.b...@rs-components.com, adwor...@googlegroups.com
Hi Juan,

Unfortunately, we don't have an example on adding ad schedules using the API. You will need to use the CampaignCriterionService with a criteria of AdScheduleInfo. You can use example as a reference. It shows how to add locations and negative keywords criteria using the CampaignCriterionService.

Regards,
Anthony
Google Ads API Team

ref:_00D1U1174p._5001UJaVr8:ref

Juan Carlos Blanco Delgado

unread,
Nov 20, 2019, 11:15:08 PM11/20/19
to AdWords API and Google Ads API Forum
Hi Anthony, 

Thank you for your reply. 

I cannot find a way to do it properly, it does not work, do you have any snippet any language to have an idea, the reference on the website is not very helpful :( 

Google Ads API Forum Advisor Prod

unread,
Nov 21, 2019, 2:48:33 PM11/21/19
to juancarlos.b...@rs-components.com, adwor...@googlegroups.com

Hi Juan,

Unfortunately, we don't have any examples on how to add it using any language. Just like with other criteria, you will need to set the fields specific to the criteria. For ad schedules, you will need to set fields such as start_hour and end_hour. If you are facing any difficulties, you can share your logs so that I can take a closer look. 



Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UJaVr8:ref
Message has been deleted

Juan Carlos Blanco Delgado

unread,
Nov 29, 2019, 4:04:51 AM11/29/19
to AdWords API and Google Ads API Forum
I found a solution but it does not work completly

campaign_criterion_service = client.GetService(
'CampaignCriterionService', version='v201809')

# Construct selector and get all campaign targets.
offset = 0
selector = {
'fields': ['DayOfWeek', 'StartHour', 'StartMinute', 'EndHour',
'EndMinute'],
'paging': {
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
}
}

page = campaign_criterion_service.get(selector)

It returns an empty campaign object, could you help me please?

See the result below

{
    'totalNumEntries': 0,
    'Page.Type': 'CampaignCriterionPage',
    'entries': []
}

If you can also help me to filter the results by campaign, like starts with of a specific string, will be also great! 

Google Ads API Forum Advisor Prod

unread,
Dec 2, 2019, 12:25:23 PM12/2/19
to juancarlos.b...@rs-components.com, adwor...@googlegroups.com
Hi Juan,

Can you please share your logs with me through reply privately to author so I can see where the issue is? If you haven't enabled logging, you can follow the steps here.

You can add filters on a campaign by adding a predicate like it is done here.

Juan Carlos Blanco Delgado

unread,
Dec 17, 2019, 11:11:53 AM12/17/19
to AdWords API and Google Ads API Forum
Hello, I made it work!!!

The problem was the MCC account I was using, I have several MCC accounts and a top MCC as well.

Now, could you help me how to update a bank and change an adschedule???

Any example???

Juan Carlos Blanco Delgado

unread,
Dec 17, 2019, 11:26:15 AM12/17/19
to AdWords API and Google Ads API Forum
Hello, sorry....

I found the solution following the example, thank you so much!!!
Reply all
Reply to author
Forward
0 new messages