使用入门

本指南将介绍如何开始编写使用 Ad Exchange Buyer REST API 与 DoubleClick Ad Exchange 互动的应用。借助 Ad Exchange Buyer REST API,您的实时出价应用既能访问和更新帐号信息,也能提交广告素材。另外,此 API 还可协助您的应用(无论是静态出价应用还是实时出价应用)发现卖方提供的直接交易。

Ad Exchange Buyer REST API v1.4 是我们建议使用的最新版本。

除了上述版本,还有一个 API 版本 2,该版本含有最新的改进和功能,目前尚处于公开测试阶段。

如果您不熟悉 Ad Exchange Buyer 的相关概念,请阅读 DoubleClick Ad Exchange 帮助中心并练习使用界面

授权前的准备工作

请完成以下步骤,为使用 OAuth 2.0 进行身份验证做好准备。此 API 支持许多类型的凭据;在本例中,我们将使用服务帐号。

  1. 转到 Google API 控制台中的“已启用的 API”页面
  2. 从项目下拉菜单中,选择一个项目或新建一个项目。
  3. 已启用的 API 列表中,确保已列出 Ad Exchange Buyer API。如果 Ad Exchange Buyer API 未被列出,请点击 Google API 标签,搜索并选择 Ad Exchange Buyer API,然后点击启用 API
  4. 接下来,在左侧的边栏中选择凭据
  5. 选择创建凭据下拉菜单,然后选择服务帐号密钥
  6. 服务帐号下拉菜单中,选择新建服务帐号
  7. 为该服务帐号输入一个名称。系统会根据此名称和项目名称自动生成相应的服务帐号 ID
  8. 记下这一服务帐号 ID:稍后在第 11 步中,您将需要在 Ad Exchange 界面中使用此 ID 向这个新的服务帐号授予访问权限。
  9. 选择密钥类型:您既可选择推荐使用的 JSON 文件,也可选择 P12(如果需要向后兼容 P12 格式的代码)。
  10. 点击创建。包含此帐号的公钥对/私钥对的 JSON 或 P12 文件即会保存到您的“下载内容”文件夹中。请将生成的 JSON 或 P12 文件存储在安全的位置。
  11. 您必须在 Ad Exchange 界面中向这个服务帐号授予访问权限,才能使该帐号正常运行。依次选择设置 > 帐号设置,接着依次选择用户管理 > 帐号用户,然后点击 +服务帐号。输入您在上面第 8 步中记下的服务帐号 ID。系统即会创建一个具有服务帐号角色的新用户。

有关详情,请参阅授权指南

调用 API

下列标签简要介绍了如何使用具有客户端库的各种语言进行编码。

Java

下面的基本示例展示了如何结合使用 Ad Exchange Buyer REST API 和 Java。

  1. 创建一个 Eclipse Maven 项目

    打开 pom.xml 并添加这些依赖项:

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

  2. 设置凭据

    对此 API 的所有调用都需要进行身份验证;请使用上文中所述的服务帐号电子邮件地址和 P12 文件创建一个 Credential

    Credential oAuth2Credential = new GoogleCredential.Builder()
            .setTransport(httpTransport)
            .setJsonFactory(jsonFactory)
            .setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
            .setServiceAccountScopes(AdExchangeBuyerScopes.all())
            .setServiceAccountPrivateKeyFromP12File(P12_FILE)
            .build();
  3. 为 AdExchangeBuyer 构建客户端

    然后,您可以使用制作工具模式创建 AdExchangeBuyer

    AdExchangeBuyer buyerService = new AdExchangeBuyer.Builder(httpTransport,
            jsonFactory, oAuth2Credential).setApplicationName(APPLICATION_NAME)
            .build();

  4. 执行操作

    在通过实例化相应客户端而连接到此 API 后,您便可执行操作了。以下代码会返回与您的已通过身份验证的帐号关联的所有 Buyer Account

    List<Account> allAccounts = buyerService.accounts().list()
            .execute().getItems();
    
        if (allAccounts != null && allAccounts.size() > 0) {
          System.out.printf("Listing of user associated accounts%n");
          for (Account account : allAccounts) {
            System.out.printf("Account id: %d%n", account.getId());
          }
        }

要详细了解如何结合使用 Ad Exchange Buyer REST API 和 Java,请参阅 Ad Exchange Buyer REST API 示例中的 README 文件。

Python

下面的基本示例展示了如何结合使用 Ad Exchange Buyer REST API 和 Python。

  1. 下载并安装 Google API Python 客户端

    使用 pip 的示例:

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

  2. 设置凭据

    对此 API 的所有调用都需要进行身份验证;请使用上文中所述的服务帐号电子邮件地址和 P12 文件创建凭据,并使用所创建的凭据向 Http 对象授权。

      oauth_credentials = client.SignedJwtAssertionCredentials(
          SERVICE_ACCOUNT_EMAIL,
          open(KEY_FILE).read(),
          scope=SCOPE)
    
      # Use the credentials to authorize an Http object
      http = oauth_credentials.authorize(httplib2.Http())
  3. 为 AdExchangeBuyer 构建客户端

    然后,您可以使用已获授权的 Http 对象创建 AdExchange Buyer 客户端:

    buyer_service = build('adexchangebuyer', VERSION, http=http)

  4. 执行操作

    在通过实例化相应客户端而连接到此 API 后,您便可执行操作了。以下代码会返回与您的已通过身份验证的帐号关联的所有 Buyer Account

    request = buyer_service.accounts().list()

要详细了解如何结合使用 Ad Exchange Buyer REST API 和 Python,请参阅 Ad Exchange Buyer REST API 示例中的 README 文件。

PHP

下面的基本示例展示了如何结合使用 Ad Exchange Buyer REST API 和 PHP。

  1. 设置依赖项

    下载并安装 google-api-php-client

  2. 设置客户端

    创建一个 Google_Client 对象。

    $client = new Google_Client();
    $client->setApplicationName(
        'DoubleClick Ad Exchange Buyer REST API PHP Samples');
  3. 设置凭据

    对此 API 的所有调用都需要有效的访问令牌。您可通过提供预先配置的密钥来获取一个令牌。

    $service = new Google_Service_AdExchangeBuyer($client);
    
    if (isset($_SESSION['service_token'])) {
        $client->setAccessToken($_SESSION['service_token']);
    }
    
    $client->setAuthConfig($key_file_location);
    $client->addScope('https://www.googleapis.com/auth/adexchange.buyer');
    
    if ($client->isAccessTokenExpired()) {
        $client->refreshTokenWithAssertion();
    }
    
    $_SESSION['service_token'] = $client->getAccessToken();
  4. 为 AdExchangeBuyer 构建客户端

    然后,您可以使用已获授权的 Google_Client 对象创建 AdExchange Buyer 客户端:

    $service = new Google_Service_AdExchangeBuyer($client);

  5. 执行操作

    在通过实例化相应客户端而连接到此 API 后,您便可执行操作了。以下代码会返回与您的已通过身份验证的帐号关联的所有 Buyer Account

    $result = $service->accounts->listAccounts();
    
        print '<h2>Listing of user associated accounts</h2>';
        if (! isset($result['items']) || ! count($result['items'])) {
            print '<p>No accounts found</p>';
            return;
        } else {
            foreach ($result['items'] as $account) {
                printf('<pre>');
                print_r($account);
                printf('</pre>');
            }
        }

要详细了解如何结合使用 Ad Exchange Buyer REST API 和 PHP,请参阅 Ad Exchange Buyer REST API 示例中的 README 文件。

.NET

下面的基本示例展示了如何结合使用 Ad Exchange Buyer REST API 和 C#。

  1. 新建项目

    打开 Visual Studio 并创建一个新项目(即控制台应用)。

  2. 向项目中添加所需的库引用

    执行以下任一操作:

    1. 使用 NuGet 添加最新版本的 Google.Apis.AdExchangeBuyer 及其依赖项。
    2. 手动下载它并添加对 DLL 的引用。要详细了解该库,请点击此处

  3. 设置凭据

    对此 API 的所有调用都需要进行身份验证;请使用上文中所述的服务帐号电子邮件地址和 JSON 文件创建一个 Credential

    ServiceAccountCredential oAuth2Credentials = new ServiceAccountCredential(
                    new ServiceAccountCredential.Initializer(
                        credentialParameters.ClientEmail)
                    {
                        Scopes = new[] { AdExchangeBuyerService.Scope.AdexchangeBuyer }
                    }.FromPrivateKey(credentialParameters.PrivateKey));
  4. 为 AdExchangeBuyer 构建客户端

    然后,您可以创建 AdExchangeBuyerService

    AdExchangeBuyerService buyerService = new AdExchangeBuyerService(
                    new BaseClientService.Initializer
                    {
                        HttpClientInitializer = oAuth2Credentials,
                        ApplicationName = "FirstAPICall"
                    });
  5. 执行操作

    在通过实例化相应客户端而连接到此 API 后,您便可执行操作了。以下代码会返回与您的已通过身份验证的帐号关联的所有 Buyer Account

    AccountsList allAccounts = buyerService.Accounts.List().Execute();
    
                foreach (Account account in allAccounts.Items)
                {
                    Console.WriteLine("Account id: {0}", account.Id);
                }
    

要详细了解如何结合使用 Ad Exchange Buyer REST API 和 C#,请参阅 Ad Exchange Buyer REST API 示例中的 README 文件。

Ruby

下面的基本示例展示了如何结合使用 Ad Exchange Buyer REST API 和 Ruby。

  1. 下载并安装 Google API Ruby 客户端

    使用 gem 的示例:

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

  2. 设置凭据

    对此 API 的所有调用都需要进行身份验证;请使用上文中所述的服务帐号电子邮件地址和 JSON 文件创建凭据。

    # Create credentials using the JSON key file.
      auth_options = {
        :json_key_io => File.open(KEY_FILE, "r"),
        :scope => "https://www.googleapis.com/auth/adexchange.buyer"
      }
    
      oauth_credentials = Google::Auth::ServiceAccountCredentials.make_creds(
        options=auth_options
      )
  3. 为 AdExchangeBuyer 构建客户端

    然后,您可以使用这些凭据创建已获授权的 AdExchange Buyer 客户端:

    # Create the service and set credentials
      ad_exchange_buyer = (
        Google::Apis::AdexchangebuyerV1_4::AdExchangeBuyerService.new
      )
      ad_exchange_buyer.authorization = oauth_credentials
      ad_exchange_buyer.authorization.fetch_access_token!
  4. 执行操作

    在通过实例化相应客户端而连接到此 API 后,您便可执行操作了。以下代码会返回与您的已通过身份验证的帐号关联的所有 Buyer Account

    # Call the Accounts resource on the service to retrieve a list of
        # Accounts for the service account.
        accounts_list = ad_exchange_buyer.list_accounts()
    
        if accounts_list.items.any?
          puts 'Found the following DoubleClick Ad Exchange Buyer Accounts:'
          accounts_list.items.each do |account|
            puts 'AccountID: %d' % account.id
            puts "\tCookie matching nid: %s" % account.cookie_matching_nid
            puts "\tCookie matching URL: %s" % account.cookie_matching_url
            puts "\tMaximum active creatives: %d" % account.maximum_active_creatives
            puts "\tMaximum total QPS: %d" % account.maximum_total_qps
            puts "\tNumber active creatives: %d" % account.number_active_creatives
            puts "\tBidder Locations:"
            account.bidder_location.each do |bidder_location|
              puts "\t\tURL: %s" % bidder_location.url
              puts "\t\t\tRegion: %s" % bidder_location.region
              puts "\t\t\tBid Protocol: %s" % bidder_location.bid_protocol
              puts "\t\t\tMaximum QPS: %s" % bidder_location.maximum_qps
            end
          end
        else
          puts 'No DoubleClick Ad Exchange Buyer Accounts were found.'
        end

要详细了解如何结合使用 Ad Exchange Buyer REST API 和 Ruby,请参阅 Ad Exchange Buyer REST API 示例中的 README 文件。

调用尚处于公开测试阶段的第 2 版 API

下列标签简要介绍了如何使用具有客户端库的各种语言进行编码。

Java

/*
 * Copyright (c) 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.api.services.samples.adexchangebuyer.cmdline;

import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient;
import com.google.api.services.adexchangebuyer2.v2beta1.AdExchangeBuyerII;
import com.google.api.services.adexchangebuyer2.v2beta1.model.Client;

import java.io.IOException;
import java.util.List;

/**
 * This sample illustrates how to retrieve all client buyers associated with a given account.
 *
 * See the <a href="Client Buyers Guide">https://developers.google.com/ad-exchange/buyer-rest/guides/client-access/clients</a>
 * for more details on the usage of this resource.
 */
public class GetAllClientBuyers extends BaseSample {
  @Override
  public ClientType getClientType() {
    return BaseSample.ClientType.ADEXCHANGEBUYERII;
  }

  @Override
  public String getName() {
    return "Get All Client Buyers";
  }

  @Override
  public String getDescription() {
    return "Lists Client Buyers associated with the given Account.";
  }

  @Override
  public void execute(AbstractGoogleJsonClient client) throws IOException {
    AdExchangeBuyerII adXClient = (AdExchangeBuyerII) client;
    long accountId = getIntInput("AccountId", "Enter the Account ID");
    List<Client> allClients = adXClient.accounts().clients().list(accountId).execute().getClients();

    if (allClients != null && allClients.size() > 0) {
      System.out.printf("========================================\n");
      System.out.printf("Listing of Client Buyers associated with AdX Account \"%s\"%n",
          accountId);
      System.out.printf("========================================\n");
      for (Client clientBuyer : allClients) {
        System.out.printf("Client Account ID: %s%n", clientBuyer.getClientAccountId());
        System.out.printf("\tClient Name: %s%n", clientBuyer.getClientName());
        System.out.printf("\tEntity ID: %s%n", clientBuyer.getEntityId());
        System.out.printf("\tEntity Name: %s%n", clientBuyer.getEntityName());
        System.out.printf("\tEntity Type: %s%n", clientBuyer.getEntityType());
        System.out.printf("\tRole: %s%n", clientBuyer.getRole());
        System.out.printf("\tStatus: %s%n", clientBuyer.getStatus());
      }
    } else {
      System.out.println("No Client Buyers were found associated to this Account.");
    }
  }
}

Python

#!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This example lists the client buyers for a given account."""

import argparse
import pprint
import sys

from apiclient.errors import HttpError
from oauth2client.client import AccessTokenRefreshError
import samples_util

DEFAULT_ACCOUNT_ID = 'ENTER_ACCOUNT_ID_HERE'

def main(ad_exchange_buyer, account_id):
  try:
    # Construct and execute the request.
    clients = ad_exchange_buyer.accounts().clients().list(
        accountId=account_id).execute()
    print 'Client buyers for account ID: %d' % account_id
    pprint.pprint(clients)
  except HttpError as e:
    print e

if __name__ == '__main__':
  parser = argparse.ArgumentParser(
      description='Lists client buyers for a given Ad Exchange account id.')
  parser.add_argument(
      '-a', '--account_id', default=DEFAULT_ACCOUNT_ID, type=int,
      help=('The integer id of the Ad Exchange account.'))
  args = parser.parse_args()

  try:
    service = samples_util.GetService(version='v2beta1')
  except IOError, ex:
    print 'Unable to create adexchangebuyer service - %s' % ex
    print 'Did you specify the key file in samples_util.py?'
    sys.exit()
  except AccessTokenRefreshError, ex:
    print 'Unable to create adexchangebuyer service - %s' % ex
    print 'Did you set the correct Service Account Email in samples_util.py?'
    sys.exit()

  main(service, args.account_id)

PHP

<?php
/*
 * Copyright 2016 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Require the base class.
require_once __DIR__ . "/../BaseExample.php";

/**
 * This example illustrates how to retrieve all buyer clients associated
 * with a given account.
 */
class ListClientBuyers extends BaseExample
{

    /**
     *
     * @see BaseExample::getInputParameters()
     */
    protected function getInputParameters()
    {
        return array(
            array(
                'name' => 'account_id',
                'display' => 'Account id',
                'required' => true
            )
        );
    }

    /**
     *
     * @see BaseExample::run()
     */
    public function run()
    {
        $values = $this->formValues;
        $result = $this->service->accounts_clients->listAccountsClients(
            $values['account_id']);
        print '<h2>Listing buyer clients</h2>';
        if (! isset($result['clients']) || ! count($result['clients'])) {
            print '<p>No buyer clients found</p>';
            return;
        } else {
            foreach ($result['clients'] as $clients) {
                $this->printResult($clients);
            }
        }
    }

    /**
     *
     * @see BaseExample::getClientType()
     */
    function getClientType()
    {
        return ClientType::AdExchangeBuyerII;
    }

    /**
     *
     * @see BaseExample::getName()
     */
    public function getName()
    {
        return 'Client Access: List Client Buyers';
    }
}

.NET

/* Copyright 2016, Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using Google.Apis.AdExchangeBuyerII.v2beta1;
using Google.Apis.AdExchangeBuyerII.v2beta1.Data;
using Google.Apis.Services;

using System;

namespace Google.Apis.AdExchangeBuyer.Examples.v2_x
{
    /// <summary>
    /// Retrieves the authenticated user's list of client buyers for the given
    /// account ID.
    /// </summary>
    public class ListClientBuyers : ExampleBase
    {
        /// <summary>
        /// Main method, to run this code example as a standalone application.
        /// </summary>
        /// <param name="args">The command line arguments</param>
        public static void Main(string[] args)
        {
            AdExchangeBuyerIIService service = Utilities.GetV2Service();
            ExampleBase example = new ListClientBuyers();
            Console.WriteLine(example.Description);

            example.Run(service);
        }

        /// <summary>
        /// Returns a description about the code example.
        /// </summary>
        public override string Description
        {
            get { return "This code example lists all client buyers for a "
                    + "given account ID."; }
        }

        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="service">An authenticated AdExchangeBuyerIIService</param>
        public override void Run(BaseClientService service)
        {
            AdExchangeBuyerIIService adXService =
                (AdExchangeBuyerIIService)service;
            long accountId = long.Parse("INSERT ACCOUNT ID HERE");

            ListClientsResponse response = adXService.Accounts.Clients
                .List(accountId).Execute();

            Console.WriteLine("========================================\n");
            Console.WriteLine("Listing of client buyers associated with AdX "
                + "Account \"{0}\"", accountId);
            Console.WriteLine("========================================\n");

            if (response.Clients.Count == 0)
            {
                Console.WriteLine("No client buyers found.");
            } else
            {
                foreach (Client clientBuyer in response.Clients)
                {
                    Console.WriteLine("Client Account ID: {0}", clientBuyer.ClientAccountId);
                    Console.WriteLine("\tClient Name: {0}", clientBuyer.ClientName);
                    Console.WriteLine("\tEntity ID: {0}", clientBuyer.EntityId);
                    Console.WriteLine("\tEntity Name: {0}", clientBuyer.EntityName);
                    Console.WriteLine("\tEntity Type: {0}", clientBuyer.EntityType);
                    Console.WriteLine("\tRole: {0}", clientBuyer.Role);
                    Console.WriteLine("\tStatus: {0}", clientBuyer.Status);
                }
            }
        }

        public override ClientType getClientType()
        {
            return ClientType.ADEXCHANGEBUYERII;
        }
    }
}

Ruby

#!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
#           you may not use this file except in compliance with the License.
#           You may obtain a copy of the License at
#
#           http://www.apache.org/licenses/LICENSE-2.0
#
#           Unless required by applicable law or agreed to in writing, software
#           distributed under the License is distributed on an "AS IS" BASIS,
#           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
#           implied.
#           See the License for the specific language governing permissions and
#           limitations under the License.
#
# Lists the client buyers for a given account.
#
# To get Account IDs, run list_accounts.rb.
#
# Tags: Accounts.Clients.list

require 'optparse'

require_relative 'samples_util'

def list_client_buyers(ad_exchange_buyer, account_id, page_size)
  begin
    client_buyers = ad_exchange_buyer.list_account_clients(
      account_id, page_size: page_size
    )

    if !client_buyers.clients.nil?
      puts 'Found the following client buyers for account ID %s:' % account_id
      client_buyers.clients.each do |client_buyer|
        puts '* Client account ID: %s' % client_buyer.client_account_id
        puts "\tClient name: %s" % client_buyer.client_name
        puts "\tEntity ID: %s" % client_buyer.entity_id
        puts "\tEntity name: %s" % client_buyer.entity_name
        puts "\tEntity Type: %s" % client_buyer.entity_type
        puts "\tRole: %s" % client_buyer.role
        puts "\tStatus: %s" % client_buyer.status
        puts "\tVisible to seller: %s" % client_buyer.visible_to_seller
      end
    else
      puts 'No client buyers found for account ID %s.' % account_id
    end

  rescue Google::Apis::ServerError => e
    puts "The following server error occured:\n%s" % e.message
  rescue Google::Apis::ClientError => e
    puts "Invalid client request:\n%s" % e.message
  rescue Google::Apis::AuthorizationError => e
    puts "Authorization error occured:\n%s" % e.message
  end
end

if __FILE__ == $0
  begin
    # Retrieve the service used to make API requests.
    service = get_service(version=ADEXCHANGEBUYER_V2BETA1)
  rescue ArgumentError => e
    puts 'Unable to create service: %s' % e.message
    puts 'Did you specify the key file in util.rb?'
    exit
  rescue Signet::AuthorizationError => e
    puts e.message
    puts 'Did you set the correct Service Account Email in samples_util.rb?'
    exit
  end

  # Set options and default values for fields used in this example.
  options = [
    Option.new(
      'account_id', 'The integer ID of the Ad Exchange buyer account.',
      :type => Integer, :short_alias => 'a', :required => true,
      :default_value => nil  # Insert default value here.
    ),
    Option.new(
      'max_page_size',
      'The maximum number of entries returned on one result page.',
      :type => Integer, :short_alias => 'm', :required => true,
      :default_value => MAX_PAGE_SIZE
    )
  ]

  # Parse options.
  parser = Parser.new(options)
  opts = parser.parse(ARGV)

  list_client_buyers(service, opts['account_id'], opts['page_size'])
end

后续步骤

  • 阅读后台指南,以便更充分地了解相关示例的具体内容以及您在开发解决方案时可用的选项。
  • 如果您有一个运行良好的客户端库,请尝试扩展代码示例以满足您的需求。
  • 要详细了解此 API,请访问与您所用版本对应的参考文档。
  • 如果您需要帮助,请访问论坛
  • 如果您希望使用自己的应用执行实时出价,请阅读 Ad Exchange 实时出价工具协议文档。
  • 阅读性能提示

参加问卷调查

请填写一份简短的调查问卷,以帮助我们完善本文档;我们非常想知道,自己在哪些方面做得比较好,在哪些方面做得不够好。

发送以下问题的反馈:

此网页
DoubleClick Ad Exchange Buyer API
DoubleClick Ad Exchange Buyer API