feed_service = client.get_service('ExtensionFeedItemService', version='v1')
extension_feed_item_operation =
client.get_type('ExtensionFeedItemOperation', version='v1')
extension_feed_item = extension_feed_item_operation.create
extension_feed_item.sitelink_feed_item.link_text.value = 'Text'
extension_feed_item.sitelink_feed_item.line1.value = 'Line 1 Value'
extension_feed_item.sitelink_feed_item.line2.value = 'Line 2 Value'
final_url = extension_feed_item.sitelink_feed_item.final_urls.add()
final_url.value = 'www.example.com'
# Add extension
try:
feed_response = (
feed_service.mutate_extension_feed_items(customer_id,
[extension_feed_item_operation])
)
except google.ads.google_ads.errors.GoogleAdsException as ex:
print('Request with ID "%s" failed with status "%s" and includes the '
'following errors:' % (ex.request_id, ex.error.code().name))
for error in ex.failure.errors:
print('\tError with message "%s".' % error.message)
if error.location:
for field_path_element in error.location.field_path_elements:
print('\t\tOn field: %s' % field_path_element.field_name)
sys.exit(1)
print('Created Sitelink %s.' % feed_response.results[0].resource_name).
This actually works. But its so hard to get Ids ...
On Thursday, 21 March 2019 19:03:21 UTC+1, googleadsapi-forumadvisor wrote:
>
> Hello,
>
> If you're using the Google Ads API, you may use the CampaignFeedService
> <https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v0.services#campaignfeedservice>
> and AdGroupFeedService
> <https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v0.services#adgroupfeedservice>
> and
> use the PlaceholderType
> <https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v0.enums#google.ads.googleads.v0.enums.PlaceholderTypeEnum.PlaceholderType>
> to
> create the Sitelink feeds. Currently we do not have a Python code sample
> to create the Sitelink extensions. We have raised this as a feature request
> to the team. To get you started, please find the attached code sample in
> Java assuming that the feed already exists to associate the Sitelink
> feeds to campaign or adgroup.
>
> Could you please give this a try with the shared sample and let me know if
> you have any other questions?
>
> Regards,
> Bharani, Google Ads API Team
>
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
> Also find us on our blog and discussion group:
> http://googleadsdeveloper.blogspot.com/search/label/adwords_api
> https://developers.google.com/adwords/api/community/
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>
> Was your question answered? Please rate your experience with us by taking
> a short survey.
> If not -- reply to this email and tell us what else we can do to help.
>
> Take Survey
> <https://support.google.com/google-ads/contact/survey_transactional?caseid=1-5962000025688&hl=en&ctx=1>
>
> Also find us on our blog and discussion group:
> http://googleadsdeveloper.blogspot.com/search/label/adwords_api
> https://developers.google.com/adwords/api/community/
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/e980c441-7f54-4c2f-a6ed-c3a0f245670c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.