View auction packages

  • You can view existing auction packages that your buyer account or one of its clients is subscribed to.

  • Individual auction packages can be retrieved using the buyers.auctionPackages.get method.

  • An error will occur if you try to view an AuctionPackage that your buyer account isn't subscribed to.

  • Multiple auction packages can be listed at the buyer-level using the buyers.auctionPackages.list method.

  • Multiple auction packages can also be listed at the bidder-level using the bidders.auctionPackages.list method, which includes those subscribed to by the bidder's buyers, clients, and media planners.

You can use the following methods to view existing auction packages that your buyer account or one of its clients is subscribed to. You can't add or change auction packages in the Marketplace API.

Get individual auction package

You can use the buyers.auctionPackages.get method to retrieve a specific AuctionPackage you or at least one of your clients are subscribed to.

You get an error if you try to view an AuctionPackage that your buyer account isn’t subscribed to.

The following sample demonstrates how you can retrieve an individual AuctionPackage with the get method.

REST

Request

GET https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/auctionPackages/558444393847004125?alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

Response

{
  "name":"buyers/12345678/auctionPackages/558444393847004125",
  "creator":"buyers/240142376",
  "displayName":"Luxury travel",
  "description":"Web, display. Verticals include: travel & transportation, hotels & accommodation, ecotourism. Ads.txt targeting: direct & reseller. Minimum predicted viewability: 75%",
  "createTime":"2038-06-28T19:12:38.823Z",
  "updateTime":"2042-01-11T18:45:14.106Z",
  "subscribedClients":[
     "buyers/12345678/clients/873721984",
     "buyers/12345678/clients/136428959"
  ]
}

Java

/*
 * Copyright 2022 Google LLC
 *
 * 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
 *
 *    https://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.authorizedbuyers.marketplace.v1.buyers.auctionPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.AuctionPackage;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils;
import java.io.IOException;
import java.security.GeneralSecurityException;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;

/**
 * This sample illustrates how to get an auction package for the given buyer and auction package ID.
 */
public class GetAuctionPackages {

  public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) {
    Long accountId = parsedArgs.getLong("account_id");
    Long auctionPackageId = parsedArgs.getLong("auction_package_id");
    String name = String.format("buyers/%s/auctionPackages/%d", accountId, auctionPackageId);

    AuctionPackage auctionPackage = null;

    try {
      auctionPackage = marketplaceClient.buyers().auctionPackages().get(name).execute();
    } catch (IOException ex) {
      System.out.printf("Marketplace API returned error response:%n%s", ex);
      System.exit(1);
    }

    System.out.printf(
        "Found auction package with ID \"%s\" for buyer account ID '%d':%n",
        auctionPackageId, accountId);
    Utils.printAuctionPackage(auctionPackage);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("GetAuctionPackages")
            .build()
            .defaultHelp(true)
            .description(("Get an auction package for the given buyer and auction package ID."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the auction package is being "
                + " retrieved. This will be used to construct the name used as a path parameter for"
                + " the auctionPackages.get request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("--auction_package_id")
        .help(
            "The resource ID of the buyers.auctionPackages resource that is being retrieved. "
                + "This will be used to construct the name used as a path parameter for the "
                + "auctionPackages.get request.")
        .required(true)
        .type(Long.class);

    Namespace parsedArgs = null;
    try {
      parsedArgs = parser.parseArgs(args);
    } catch (ArgumentParserException ex) {
      parser.handleError(ex);
      System.exit(1);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace API service:%n%s", ex);
      System.out.println("Did you specify a valid path to a service account key file?");
      System.exit(1);
    } catch (GeneralSecurityException ex) {
      System.out.printf("Unable to establish secure HttpTransport:%n%s", ex);
      System.exit(1);
    }

    execute(client, parsedArgs);
  }
}

List multiple auction packages (buyer-level)

You can use buyers.auctionPackages.list method to page through all auction packages a buyers and its clients are subscribed to.

The following sample demonstrates how you can list auction packages with the list method.

REST

Request

GET https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/auctionPackages?pageSize=3&alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

Response

{
 "auctionPackages": [
   {
     "name": "buyers/12345678/auctionPackages/558444393847004125",
     "creator": "buyers/240142376",
     "displayName": "Luxury travel",
     "description": "Web, display. Verticals include: travel & transportation, hotels & accommodation, ecotourism. Ads.txt targeting: direct & reseller. Minimum predicted viewability: 75%",
     "createTime": "2038-06-28T19:12:38.823Z",
     "updateTime": "2042-01-11T18:45:14.106Z",
     "subscribedClients": [
       "buyers/12345678/clients/873721984",
       "buyers/12345678/clients/136428959"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393847627347",
     "creator": "buyers/143579823",
     "displayName": "Mars Top 25 Video",
      "description": "Top 25 Sites in Mars Video",
     "createTime": "2040-11-16T16:45:46.185Z",
     "updateTime": "2041-05-03T13:53:17.151Z",
     "subscribedClients": [
       "buyers/12345678/clients/142940840"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393848195715",
     "creator": "buyers/12345678",
     "displayName": "Mars Top 100 Sports",
     "createTime": "2041-11-29T16:07:43.631Z",
     "updateTime": "2041-11-29T16:07:43.631Z"
   }
 ],
 "nextPageToken": "CAMQ5Ja-7a7g9gIY5Ja-7a7g9gI="
}

Java

/*
 * Copyright 2022 Google LLC
 *
 * 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
 *
 *    https://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.authorizedbuyers.marketplace.v1.buyers.auctionPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.AuctionPackage;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.ListAuctionPackagesResponse;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.List;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;

/** This sample illustrates how to list auction packages for a given buyer account ID. */
public class ListAuctionPackages {

  public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) {
    Long accountId = parsedArgs.getLong("account_id");
    Integer pageSize = parsedArgs.getInt("page_size");
    String parentBuyerName = String.format("buyers/%s", accountId);
    String pageToken = null;

    System.out.printf("Found auction packages for buyer Account ID '%d':%n", accountId);

    do {
      List<AuctionPackage> auctionPackages = null;

      try {
        ListAuctionPackagesResponse response =
            marketplaceClient
                .buyers()
                .auctionPackages()
                .list(parentBuyerName)
                .setPageSize(pageSize)
                .setPageToken(pageToken)
                .execute();

        auctionPackages = response.getAuctionPackages();
        pageToken = response.getNextPageToken();
      } catch (IOException ex) {
        System.out.printf("Marketplace API returned error response:%n%s", ex);
        System.exit(1);
      }
      if (auctionPackages == null) {
        System.out.println("No auction packages found.");
      } else {
        for (AuctionPackage auctionPackage : auctionPackages) {
          Utils.printAuctionPackage(auctionPackage);
        }
      }
    } while (pageToken != null);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("ListAuctionPackages")
            .build()
            .defaultHelp(true)
            .description(("Lists publisher profiles associated with the given buyer account."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the auction packages resource "
                + "is being accessed. This will be used to construct the parent used as a path "
                + "parameter for the auctionPackages.list request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-p", "--page_size")
        .help(
            "The number of rows to return per page. The server may return fewer rows than "
                + "specified.")
        .setDefault(Utils.getMaximumPageSize())
        .type(Integer.class);

    Namespace parsedArgs = null;
    try {
      parsedArgs = parser.parseArgs(args);
    } catch (ArgumentParserException ex) {
      parser.handleError(ex);
      System.exit(1);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace API service:%n%s", ex);
      System.out.println("Did you specify a valid path to a service account key file?");
      System.exit(1);
    } catch (GeneralSecurityException ex) {
      System.out.printf("Unable to establish secure HttpTransport:%n%s", ex);
      System.exit(1);
    }

    execute(client, parsedArgs);
  }
}

List multiple auction packages (bidder-level)

You can use bidders.auctionPackages.list method to page through all auction packages a bidder, and its buyers, clients, and media planners are subscribed to.

The following sample demonstrates how you can list auction packages with the list method.

REST

Request

GET https://authorizedbuyersmarketplace.googleapis.com/v1/bidders/12345678/auctionPackages?pageSize=3&alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

Response

{
 "auctionPackages": [
   {
     "name": "buyers/12345678/auctionPackages/558444393847004125",
     "creator": "buyers/240142376",
     "displayName": "Luxury travel",
     "description": "Web, display. Verticals include: travel & transportation, hotels & accommodation, ecotourism. Ads.txt targeting: direct & reseller. Minimum predicted viewability: 75%",
     "createTime": "2038-06-28T19:12:38.823Z",
     "updateTime": "2042-01-11T18:45:14.106Z",
     "subscribedClients": [
       "buyers/12345678/clients/873721984",
       "buyers/12345678/clients/136428959"
     ],
     "subscribedMediaPlanners": [
        {
           "accountId": "11111111"
        }
     ],
     "eligibleSeatIds": [
        "test_seat1",
        "test_seat2",
        "test_seat3"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393847627347",
     "creator": "buyers/143579823",
     "displayName": "Mars Top 25 Video",
      "description": "Top 25 Sites in Mars Video",
     "createTime": "2040-11-16T16:45:46.185Z",
     "updateTime": "2041-05-03T13:53:17.151Z",
     "subscribedClients": [
       "buyers/12345678/clients/142940840"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393848195715",
     "creator": "buyers/12345678",
     "displayName": "Mars Top 100 Sports",
     "createTime": "2041-11-29T16:07:43.631Z",
     "updateTime": "2041-11-29T16:07:43.631Z"
   }
 ],
 "nextPageToken": "CAMQ5Ja-7a7g9gIY5Ja-7a7g9gI="
}