Hide

Get Started

This document explains how to get started writing applications that use the Ad Exchange Seller REST API to interact with DoubleClick Ad Exchange. The Ad Exchange Seller REST API enables developers to obtain reports on Ad Exchange earnings and manage Ad Exchange ad clients , URL channels and custom channels .

Ad Exchange Seller REST API v2.0 is the latest available and recommended version.

1. Before you start

  1. If you're unfamiliar with Ad Exchange Seller concepts, read the DoubleClick Ad Exchange Help and experiment with the user interface.

2. Prepare for Authentication

Complete the following steps to prepare for authentication using OAuth 2.0; the API supports many types of credentials, for this example we will use an installed application client secrets file.

  • Go to the Google Developers Console.
  • Select a project.
  • In the sidebar on the left, select APIs and make sure the status is ON for Ad Exchange Seller REST API.
  • In the sidebar on the left, select Credentials.
  • If you do not already have a Client ID for native application
    • Select Create new Client ID.
    • Select Installed application and other and create the new ID.
  • Select Download JSON and keep the client secrets file in a safe place.

See Authentication for more information.

3. Call the Seller REST API

The tabs below provide quickstarts for coding in each of the languages for which there is a client library.

Java

Here is a basic example that shows how to use the Ad Exchange Seller REST API with Java.

  1. Create an Eclipse maven project

    Open the pom.xml and add these dependencies:

      <dependencies>
        <dependency>
          <groupId>com.google.apis</groupId>
          <artifactId>google-api-services-adexchangeseller</artifactId>
          <version>RELEASE</version>
        </dependency>
        <dependency>
          <groupId>com.google.http-client</groupId>
          <artifactId>google-http-client-jackson2</artifactId>
          <version>RELEASE</version>
        </dependency>
         <dependency>
          <groupId>com.google.oauth-client</groupId>
          <artifactId>google-oauth-client-jetty</artifactId>
          <version>RELEASE</version>
        </dependency>
      </dependencies>
      

  2. Load the client secrets file

    All calls to the API require authentication; load up the client secrets file you downloaded to create a GoogleClientSecrets object.

  3. Set up your credentials

    Create a Credential object using the GoogleClientSecrets.

  4. Construct a client for the AdExchangeSeller

    Use the Credential object to create an authenticated AdExchangeSeller using the Builder pattern:

  5. Perform an operation

    After you've instantiated a client to connect to the API, you can perform an operation. The following code runs a Report and displays the output.

For more detailed information about using the Ad Exchange Seller REST API with Java, refer to the README file in the Ad Exchange Seller REST API examples.

Python

Here is a basic example that shows how to use the Ad Exchange Seller REST API with Python.

  1. Download and install the Google API Python Client

    Example using pip:

    $ pip --upgrade google-api-python-client

  2. Construct a client for the AdExchangeSeller

    Create a client for the AdExchangeSeller API passing in the latest version of the API.

    Note: this approach expects a client_secrets.json file in the same directory as the .py file; this is the file you downloaded in Step 2. above

  3. Perform an operation

    After you've instantiated a client to connect to the API, you can perform an operation. The following code runs a Report and displays the output.

For more detailed information about using the Ad Exchange Seller REST API with Python, refer to the README file in the Ad Exchange Seller REST API examples.

PHP

Here is a basic example that shows how to use the Ad Exchange Seller REST API with PHP.

  1. Setup dependencies

    Download and install google-api-php-client.

    Add this to your include path

  2. Create a Google_Client object

  3. Set up your credentials

    All calls to the API require authentication; load up the client secrets file you downloaded and add a scope for your requests.

  4. Construct a client for the AdExchangeSeller

    You can then create your AdExchange Seller client using the authorized Google_Client object:

  5. Perform an operation

    After you've instantiated a client to connect to the API, you can perform an operation. The following code runs a Report and displays the output.

For more detailed information about using the Ad Exchange Seller REST API with PHP, refer to the README file in the Ad Exchange Seller REST API examples.

Ruby

Here is a basic example that shows how to use the Ad Exchange Seller REST API with Ruby.

  1. Download and install the Google API Ruby Client

    Example using gem:

    $ gem install google-api-client
    $ gem update -y google-api-client

  2. Load the client secrets file

    All calls to the API require authentication; start by loading up the client secrets file you downloaded.

  3. Set up your credentials

    Create credentials using the loaded client secrets info.

  4. Construct a client for the AdExchangeSeller

    Create an authorized client for the AdExchangeSeller API by passing in the credentials.

  5. Perform an operation

    After you've instantiated a client to connect to the API, you can perform an operation. The following code runs a Report and displays the output.

For more detailed information about using the Ad Exchange Seller REST API with Python, refer to the README file in the Ad Exchange Seller REST API examples.

4. Next Steps

Read the background information to more fully understand what is happening in the samples and the options available to you in writing your solution.

When you have got a client library up and running, go ahead and play with the code examples to extend them for your needs.

Visit the reference documentation for the version you are working with to learn more about the API.

For more need help, read the advanced topics listed under the Guides section.

5. Survey

Help us improve this documentation; tell us what worked and what we missed by filling out a quick survey.

Send feedback about...

Seller REST API