Friday, March 14, 2014

Google Ads Developer Blog

Google Ads Developer Blog


Introducing a new type of feed for AdWords API: Review extensions

Posted: 13 Mar 2014 10:21 AM PDT

Review extensions, which let you show accolades from reputable third parties right in your search ads, were introduced last year. We have now made this feature available for the AdWords API in v201402.

Creating review extensions is the same as creating sitelinks as described in this guide. The only differences are:
  • The different placeholderId for FeedMappingService. As shown in the feed placeholders page, the placeholderId for review extensions is 8.
  • A different set of Feed attributes for FeedService. A review extension consists of four attributes:
    • Text (String): Either an exact quote or paraphrase from a third-party source that appears beneath your ad
    • Source (String): Name of the third-party publisher of the quoted or paraphrased review you're using in your review extension
    • Source URL (URL): Landing page of the third-party website where the quoted or paraphrased review is located
    • Format (Boolean): Indicates whether your review is formatted as an exact quote from the third-party source, or if you're paraphrasing. Setting to true means your review is formatted as an exact quote, false means paraphrasing.
Here is the Java code to create a Feed for review extensions. Code examples in other programming languages are available as part of the client libraries.

FeedAttribute textAttribute = new FeedAttribute();
textAttribute.setType(FeedAttributeType.STRING);
textAttribute.setName("Text");

FeedAttribute sourceNameAttribute = new FeedAttribute();
sourceNameAttribute.setType(FeedAttributeType.STRING);
sourceNameAttribute.setName("Source Name");

FeedAttribute sourceUrlAttribute = new FeedAttribute();
sourceUrlAttribute.setType(FeedAttributeType.URL);
sourceUrlAttribute.setName("Source URL");

FeedAttribute exactlyQuotedAttribute = new FeedAttribute();
exactlyQuotedAttribute.setType(FeedAttributeType.BOOLEAN);
exactlyQuotedAttribute.setName("Exactly Quoted");

Feed reviewExtensionFeed = new Feed();
reviewExtensionFeed.setName("Feed For ReviewExtension from API");
reviewExtensionFeed.setAttributes(
new FeedAttribute[] {textAttribute, sourceNameAttribute,
sourceUrlAttribute, exactlyQuotedAttribute});
If you have any questions about this feature or the AdWords API in general, you can post them on the developer forum. You can also follow the Google+ page for updates about the AdWords API.

Reminder: AdWords API v201306 and Ad Exchange Buyer SOAP API v201306 to be sunset on March 31

Posted: 13 Mar 2014 07:44 AM PDT

As we have previously announced, if you're using the AdWords API or Ad Exchange Buyer SOAP API v201306, please note that support for this version will end on March 31st, 2014. If you are still using v201306 after that date, all requests will fail and your application will cease working until you migrate to a supported version. You can reference either the v201309 or v201402 migration guides for help upgrading to one of these versions.

In addition, remember that ClientLogin support is deprecated and you will have to migrate to OAuth 2.0 in order to authenticate starting in version v201402. It may be best to get this out of the way now, because with the sunset of v201309 on July 21st, 2014, all support for ClientLogin will go away and OAuth 2.0 will be required to access the API. Please reference our OAuth 2.0 migration guide for help with this process.

If you have any questions about this upcoming change or anything else related to the AdWords API, please contact us on the forum or via our Google+ page.

A new way to access our Ads SOAP APIs through Python

Posted: 13 Mar 2014 07:05 AM PDT

The Ads APIs Python client library, adspygoogle, has been around for quite some time, supporting versions of Python as old as 2.4 but capping out at 2.7. We've been getting more and more feedback recently that our users want Python 3 support. Also, many of adspygoogle's dependencies are dated and no longer officially supported. We heard you, and with these items in mind...

A New Client Library

A completely new client library — googleads — is now available for Python 3 as well as Python 2.7. The new library has several advantages over our existing library:

  • Most of your code from the previous Python library will work with minimal modifications, listed below and in our migration guide.
  • The dependencies are all hosted on PyPI, so you do not need to use the --allow-external or --allow-unverified flags at install.
  • The constructors and attributes in the new library give you more control over client objects; for example, you can easily switch out OAuth 2.0 credentials and manage multiple accounts.
  • Data types are retained. Whereas adspygoogle uses strings for everything, googleads can send and receive numbers, booleans, datetimes, etc.
  • The library is more integrated with the Python standard library; for example, you can use the built-in logging framework to log SOAP messages.
  • The library is built on top of a fork of suds and allows users who are familiar with suds to take advantage of that library's features.

Migrating to the New Client Library

Existing Python users can retain almost all of their logic working with the objects defined in our APIs. An important difference is that your responses from the API are now objects returned by suds instead of dictionaries. The objects support using dictionary syntax to retrieve values but you cannot use dictionary methods on them. Most importantly, this means that .get() and .update() are no longer supported. Where in adspygoogle you may have done this:

response = inventory_service.GetAdUnitsByStatement(statement.ToStatement())[0] ad_units = response.get('results')

You will now need to do this:

response = inventory_service.getAdUnitsByStatement(statement.ToStatement()) ad_units = response['results'] if 'results' in response else None

Some more minor changes that need to be made include changing your code to use the new methods for instantiating client and service objects and using the exact method names from our APIs, which are generally lower camel case.

For more information on migration, check out the migration guide we have posted in the new library's wiki section.

The googleads library will be the primary focus of development moving forward. The existing adspygoogle library is now in maintenance mode but we will continue to add support for new AdWords and DFP API releases through December, 2014.

If you find any bugs, have a patch to contribute or just a feature request, please feel free to file an issue on the issue tracker.

No comments:

Post a Comment