Hi Josh,
thank you for your quick reply,
i have written send multiple *CampaignExtensionSettingOperations* in a
single CampaignExtensionSettingService.mutate
<https://developers.google.com/adwords/api/docs/reference/v201506/CampaignExtensionSettingService#mutate>
call
and it worked fine,
Regards,
Anup
On Friday, July 10, 2015 at 5:18:38 PM UTC+5:30, Anup Pathak wrote:
>
> Hi
>
> i am using add_site_links.py for add sitelink in campaign, i would like to
> add these sitelink in bulk
>
> here is my example
>
> CAMPAIGN_ID = 'INSERT_CAMPAIGN_ID_HERE'
> def main(client, campaign_id):
> # Initialize appropriate services.
> campaign_extension_setting_service =
> client.GetService('CampaignExtensionSettingService', version='v201502')
> customer_service = client.GetService('CustomerService',
> version='v201502')
>
> sitelink1 = {
> 'xsi_type': 'SitelinkFeedItem',
> 'sitelinkText': 'Store Hours',
> sitelinkFinalUrls':{
> 'xsi_type':'UrlList',
> 'urls':'
> http://www.example.com/thanksgiving',
> },
> 'sitelinkLine2': 'ad_template_desc_line1',
> 'sitelinkLine3': 'ad_template_desc_line2',
> 'startTime': datetime(start_date_year,
> start_date_month, start_date_date, 0, 0, 0, 0,
> customer_tz).strftime(time_fmt),
> 'endTime': datetime(end_date_year, end_date_month,
> end_date_date, 23, 59, 59, 59, customer_tz).strftime(time_fmt),
> }
> # Create your Campaign Extension Settings. This associates the sitelinks
> # to your campaign.
> campaign_extension_setting = {
> 'campaignId': campaign_id,
> 'extensionType': 'SITELINK',
> 'extensionSetting': {
> 'extensions': [sitelink1]
> }
> }
>
> operation = {
> 'operator': 'ADD',
> 'operand': campaign_extension_setting
> }
>
> # Add the extensions.
> response = campaign_extension_setting_service.mutate([operation])
>
> if 'value' in response:
> print ('Extension setting with type "%s" was added to campaignId
> "%d".' %
> (response['value'][0]['extensionType'],
> response['value'][0]['campaignId']))
> else:
> raise errors.GoogleAdsError('No extension settings were added.')
>
>
> if __name__ == '__main__':
> # Initialize client object.
> adwords_client = adwords.AdWordsClient.LoadFromStorage()
>
> main(adwords_client, CAMPAIGN_ID)
>
> when i am adding single request it is working fine, but i would like to
> add in bulk,
>
> i have tried using 'xsi_type': 'CampaignExtensionSettingOperation' but not
> working below is my sample code
>
>
> sitelink1 = {
> 'xsi_type': 'SitelinkFeedItem',
> 'sitelinkText': 'ad_template_headline',
> 'sitelinkFinalUrls':{
> 'xsi_type':'UrlList',
> 'urls':'
> http://www.example.com/thanksgiving',
> },
> 'sitelinkLine2': 'ad_template_desc_line1',
> 'sitelinkLine3': 'ad_template_desc_line2',
> 'startTime': datetime(start_date_year,
> start_date_month, start_date_date, 0, 0, 0, 0,
> customer_tz).strftime(time_fmt),
> 'endTime': datetime(end_date_year, end_date_month,
> end_date_date, 23, 59, 59, 59, customer_tz).strftime(time_fmt),
> }
> campaign_extension_setting = {
> 'campaignId': campaign_id,
> 'extensionType': 'SITELINK',
> 'extensionSetting': {
> 'extensions':
> [sitelink1]
> }
> }
> operations= []
>
> operations.append ({
> 'xsi_type': 'CampaignExtensionSettingOperation',
> 'operator': 'ADD',
> 'operand': campaign_extension_setting
> })
> policy = {
> 'prerequisiteJobIds': []
> }
> bulk_update_in_stages(operations, policy,
> adwords_operations.get_client(customer_id))
>
>
> it will be great if you are able to provide me simple demo example or
> steps for it!
>
> Thank You!
> Anup
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords 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
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/64d981bb-85c1-4e72-9616-1038fb0c611c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.