Google Ad Manager API: Node.js Client

release level npm version

Google Ad Manager API client for Node.js

A comprehensive list of changes in each version may be found in the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Google Ad Manager API API.
  4. Set up authentication so you can access the API from your local workstation.

Installing the client library

npm install @google-ads/admanager

Using the client library

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. The parent, which owns this collection of AdUnitSizes.
 *  Format: `networks/{network_code}`
 */
// const parent = 'abc123'
/**
 *  Optional. The maximum number of AdUnitSizes to return. The service may
 *  return fewer than this value. If unspecified, at most 50 ad unit sizes will
 *  be returned. The maximum value is 1000; values above 1000 will be coerced
 *  to 1000.
 */
// const pageSize = 1234
/**
 *  Optional. A page token, received from a previous `ListAdUnitSizes` call.
 *  Provide this to retrieve the subsequent page.
 *  When paginating, all other parameters provided to `ListAdUnitSizes` must
 *  match the call that provided the page token.
 */
// const pageToken = 'abc123'
/**
 *  Optional. Expression to filter the response.
 *  See syntax details at
 *  https://developers.google.com/ad-manager/api/beta/filters
 */
// const filter = 'abc123'
/**
 *  Optional. Expression to specify sorting order.
 *  See syntax details at
 *  https://developers.google.com/ad-manager/api/beta/filters#order
 */
// const orderBy = 'abc123'
/**
 *  Optional. Number of individual resources to skip while paginating.
 */
// const skip = 1234

// Imports the Admanager library
const {AdUnitServiceClient} = require('@google-ads/admanager').v1;

// Instantiates a client
const admanagerClient = new AdUnitServiceClient();

async function callListAdUnitSizes() {
  // Construct request
  const request = {
    parent,
  };

  // Run request
  const iterable = admanagerClient.listAdUnitSizesAsync(request);
  for await (const response of iterable) {
    console.log(response);
  }
}

callListAdUnitSizes();

Samples

Samples are in the samples/ directory. Each sample's README.md has instructions for running its sample.

Sample Source Code Try it
Ad_unit_service.get_ad_unit source code Open in Cloud Shell
Ad_unit_service.list_ad_unit_sizes source code Open in Cloud Shell
Ad_unit_service.list_ad_units source code Open in Cloud Shell
Company_service.get_company source code Open in Cloud Shell
Company_service.list_companies source code Open in Cloud Shell
Custom_field_service.get_custom_field source code Open in Cloud Shell
Custom_field_service.list_custom_fields source code Open in Cloud Shell
Custom_targeting_key_service.get_custom_targeting_key source code Open in Cloud Shell
Custom_targeting_key_service.list_custom_targeting_keys source code Open in Cloud Shell
Custom_targeting_value_service.get_custom_targeting_value source code Open in Cloud Shell
Custom_targeting_value_service.list_custom_targeting_values source code Open in Cloud Shell
Entity_signals_mapping_service.batch_create_entity_signals_mappings source code Open in Cloud Shell
Entity_signals_mapping_service.batch_update_entity_signals_mappings source code Open in Cloud Shell
Entity_signals_mapping_service.create_entity_signals_mapping source code Open in Cloud Shell
Entity_signals_mapping_service.get_entity_signals_mapping source code Open in Cloud Shell
Entity_signals_mapping_service.list_entity_signals_mappings source code Open in Cloud Shell
Entity_signals_mapping_service.update_entity_signals_mapping source code Open in Cloud Shell
Network_service.get_network source code Open in Cloud Shell
Network_service.list_networks source code Open in Cloud Shell
Order_service.get_order source code Open in Cloud Shell
Order_service.list_orders source code Open in Cloud Shell
Placement_service.get_placement source code Open in Cloud Shell
Placement_service.list_placements source code Open in Cloud Shell
Report_service.create_report source code Open in Cloud Shell
Report_service.fetch_report_result_rows source code Open in Cloud Shell
Report_service.get_report source code Open in Cloud Shell
Report_service.list_reports source code Open in Cloud Shell
Report_service.run_report source code Open in Cloud Shell
Report_service.update_report source code Open in Cloud Shell
Role_service.get_role source code Open in Cloud Shell
Role_service.list_roles source code Open in Cloud Shell
Taxonomy_category_service.get_taxonomy_category source code Open in Cloud Shell
Taxonomy_category_service.list_taxonomy_categories source code Open in Cloud Shell
User_service.get_user source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell

The Google Ad Manager API Node.js Client API Reference documentation also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-ads/admanager@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be in preview. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE