Ad Exchange Seller REST API

Getting Started

The Ad Exchange Seller REST API enables developers to obtain reports on Ad Exchange earnings and manage Ad Exchange ad clients, ad units, URL channels, and custom channels.

Ad Exchange Seller REST API v1.1 is the latest available and recommended version.

Basic concepts

The Ad Exchange Seller REST API is built upon some basic Ad Exchange sell-side concepts:

  • Ad Clients: Ad clients represent an association between an Ad Exchange account and an Ad Exchange product, such as Content Ads, Video Ads, or Mobile Ads. An Ad Exchange account can have one or multiple ad clients.
  • Ad Units: Ad units are user-configured placeholders for ads, that define some properties for the ads being shown (such as size and shape).
  • Channels: Channels are tools that let you track the performance of a subset of your ad units. There are two types of channels: URL and custom. The former lets you track performance across a specific page or domain, whereas the latter help you track performance on specific user-selected groups of ad units.
  • Reports: Reports give you insight into what you're earning, as well as what's having an impact on those earnings. They can be run on an entire account or on a subset of ad units, through the use of channels.

Supported operations

The operations currently supported by the API are described in the table below.

Operation Description REST HTTP mappings
list Lists all resources within a collection. GET on a collection URI.
get Gets a specific resource. GET on a resource URI.
generate Generate a result set based on a specified resource. Used only for reports. GET on a collection URI, where the resource you specify defines the characteristics of the generated report.

All operations require authorization.

Calling style

REST is a style of software architecture that provides a convenient and consistent approach to requesting and modifying data.

The term REST is short for "Representational State Transfer." In the context of Google APIs, it refers to using HTTP verbs to retrieve and modify representations of data stored by Google.

In a RESTful system, resources are stored in a data store; a client sends a request that the server perform a particular action (such as creating, retrieving, updating, or deleting a resource), and the server performs the action and sends a response, often in the form of a representation of the specified resource.

In Google's RESTful APIs, the client specifies an action using an HTTP verb such as POST, GET, PUT, or DELETE. It specifies a resource by a globally-unique URI of the following form:

https://www.googleapis.com/apiName/apiVersion/resourcePath?parameters

Because all API resources have unique HTTP-accessible URIs, REST enables data caching and is optimized to work with the web's distributed infrastructure.

For more information about REST, you may find the following third-party documents useful:

REST in the Ad Exchange Seller REST API

The supported operations map directly to REST HTTP verbs, as described in Ad Exchange Seller REST API operations.

The specific format for Ad Exchange Seller REST API URIs are:

https://www.googleapis.com/adexchangeseller/v1.1/resourceID?parameters

where resourceID is the identifier for an ad client, ad unit, URL channel, custom channel or the reports collection, and parameters are any parameters to apply to the query.

The format of the resourceID path extensions lets you identify the resource on which you are currently operating, for example:

https://www.googleapis.com/adexchangeseller/v1.1/adclients
https://www.googleapis.com/adexchangeseller/v1.1/adclients/adClientId
https://www.googleapis.com/adexchangeseller/v1.1/adclients/adClientId/adunits
https://www.googleapis.com/adexchangeseller/v1.1/adclients/adClientId/adunits/adUnitId
https://www.googleapis.com/adexchangeseller/v1.1/adclients/adClientId/urlchannels
...

The full set of URIs used for each supported operation in the API is summarized in the Ad Exchange Seller REST API Reference document.

Here are a couple of examples of how this works in the Ad Exchange Seller REST API.

List ad clients:

GET http://www.googleapis.com/adexchangeseller/v1.1/adclients/

List ad units in ad client ca-pub-1234567890123456:

GET http://www.googleapis.com/adexchangeseller/v1.1/adclients/ca-pub-1234567890123456/adunits

Data format

JSON (JavaScript Object Notation) is a common, language-independent data format that provides a simple text representation of arbitrary data structures. For more information, see json.org.

Making requests

Authorizing requests

Every request your application sends to the Ad Exchange Seller REST API must include an authorization token. The token also identifies your application to Google.

About authorization protocols

We recommend using OAuth 2.0 to authorize requests.

If your application has certain unusual authorization requirements, such as logging in at the same time as requesting data access (hybrid) or domain-wide delegation of authority (2LO), then you cannot currently use OAuth 2.0 tokens. In such cases, you must instead use OAuth 1.0 tokens and an API key. To find your application's API key:

  1. Go to the Google Developers Console.
  2. Select a project.
  3. In the sidebar on the left, select APIs & auth. In the displayed list of APIs, make sure the Ad Exchange Seller REST API status is set to ON.
  4. In the sidebar on the left, select Credentials.
  5. Find the line or lines labeled API key. If there is no API key, then create one by selecting Create New Key. For more about API keys, see the Console help.

Authorizing requests with OAuth 2.0

All requests to the Ad Exchange Seller REST API must be authorized by an authenticated user.

The details of the authorization process, or "flow," for OAuth 2.0 vary somewhat depending on what kind of application you're writing. The following general process applies to all application types:

  1. When you create your application, you register it using the Google Developers Console. Google then provides information you'll need later, such as a client ID and a client secret.
  2. Activate the Ad Exchange Seller REST API in the Google Developers Console. (If the API isn't listed in the Developers Console, then skip this step.)
  3. When your application needs access to user data, it asks Google for a particular scope of access.
  4. Google displays a consent screen to the user, asking them to authorize your application to request some of their data.
  5. If the user approves, then Google gives your application a short-lived access token.
  6. Your application requests user data, attaching the access token to the request.
  7. If Google determines that your request and the token are valid, it returns the requested data.

Some flows include additional steps, such as using refresh tokens to acquire new access tokens. For detailed information about flows for various types of applications, see Google's OAuth 2.0 documentation.

Here's the OAuth 2.0 scope information for the Ad Exchange Seller REST API:

Scope Meaning
https://www.googleapis.com/auth/adexchange.seller Read/write access to Ad Exchange data.
https://www.googleapis.com/auth/adexchange.seller.readonly Read-only access to Ad Exchange data.

To request access using OAuth 2.0, your application needs the scope information, as well as information that Google supplies when you register your application (such as the client ID and the client secret).

Tip: The Google APIs client libraries can handle some of the authorization process for you. They are available for a variety of programming languages; check the page with libraries and samples for more details.

Making a request

The final step is making the API request. If you're not using any client libraries, you can take a look at the reference documentation.

If you're using the client libraries, this task is significantly easier. See the client library page for more information.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.