Although we provide API examples as part of every client library, we also have a few larger demo applications that show usage of the various parts of the API in more complex scenarios. Here we showcase a number of different ways of using the API in and outside of common use cases.
We are sharing this code as open source to provide a starting point for new developers and to demonstrate some of the core functionality in the API. We encourage you to use it as a reference as well as a foundation for your creative ideas.
Currently the following demos are available:
- Sandbox Account Viewer (Java AdWords API library)
- AdWords API on Rails (Ruby AdWords API library)
- AdWords API on App Engine (Python AdWords API library)
- AdWords API on App Engine - Reporting (Python AdWords API library)
We are looking forward for your feedback as well as code contributions! If you added some cool functionality to one of our demos, we'd love to see it to consider it for the next releases.
Sandbox Account Viewer
The Sandbox Account Viewer is a sample application that demonstrates how to use the AdWords API client library to display contents of an AdWords sandbox account. It can be used to visualize the effects of a request on your account and to retrieve information such as IDs that are needed when running examples.
Features:
- AdWords objects browsing via tree-based UI;
- Detailed object view with every property outlined;
- Access to both production and sandbox environments;
- Online documentation.
Note: The Sandbox Account Viewer does not attempt to replicate the official AdWords web interface, but rather displays information exactly as it is returned by the API.
AdWords API on Rails
The AdWords on Rails sample application demonstrates how to access the AdWords API from within a Ruby on Rails environment. It is based on the Google Ruby AdWords API client library.
The application demonstrates the following:
- Authorization against AdWords with OAuth2.0 schema and credentials re-use.
- Simple service request (CampaignService.get) and displaying the results.
- Basic AdHoc reporting functionality with downloads support.
Check out this code walkthrough to understand the application quicker.
AdWords API on App Engine (Python)
In this demo, we access a given Sandbox account using AdWords API from a Google AppEngine application written in Python. In order for the web application to communicate with the API, we use the AdWords API Python Client Library.
The demo supports the following operations and features: retrieve existing campaigns, retrieve stats for each campaign, add new campaigns, update campaign's budget, retrieve existing ad groups, add new ad groups, and keep track of API usage for each user.
Note: SOAP requests can take some time to complete - longer than Google App Engine will allow. For production-grade web applications, we recommend using asynchronous web service calls and AJAX to allow for requests that take longer to complete.
AdWords API on App Engine (Python) - Reporting
In this demo, we download reports using AdWords API from a Google AppEngine application written in Python. In order for the web application to communicate with the API, we use the AdWords API Python Client Library.
The demo will use OAuth to display a list of accounts to report against. You can request the same report from multiple accounts at once—they will be processed asynchronously and stored in the Blobstore until you are ready to download them.