### Client Library Setup - Ruby (Install) Source: https://developers.google.com/ad-manager/api/beta/getting-started Install the google-ads-ad_manager gem after adding it to your Gemfile. ```APIDOC ## Set up your client library ### Method N/A (gem install) ### Endpoint N/A ### Parameters #### gem install command - **gem install google-ads-ad_manager** - Installs the specified gem. ### Request Example ```bash gem install google-ads-ad_manager ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Ruby Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the google-ads-ad_manager gem to your Gemfile and install it. ```APIDOC ## Set up your client library ### Method N/A (RubyGems Installation) ### Endpoint N/A ### Parameters #### Gemfile Entry - **gem 'google-ads-ad_manager', '~> 0.2.0'** - Specifies the gem and version constraint. ### Request Example ```ruby gem 'google-ads-admanager', '~> 0.2.0' ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Python Source: https://developers.google.com/ad-manager/api/beta/getting-started Install the Google Ads Ad Manager client library for Python using pip. ```APIDOC ## Set up your client library ### Method N/A (pip Installation) ### Endpoint N/A ### Parameters #### pip Package - **google-ads-admanager** (string) - The name of the package to install. ### Request Example ```bash pip install google-ads-admanager ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Node.js (npm) Source: https://developers.google.com/ad-manager/api/beta/getting-started Install the @google-ads/admanager npm package from the command line. ```APIDOC ## Set up your client library ### Method N/A (npm Installation) ### Endpoint N/A ### Parameters #### npm package - **@google-ads/admanager** (string) - The npm package name. ### Request Example ```bash npm install @google-ads/admanager ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - PHP Source: https://developers.google.com/ad-manager/api/beta/getting-started Install the Ad Manager client library for PHP using Composer. ```APIDOC ## Set up your client library ### Method N/A (Composer Installation) ### Endpoint N/A ### Parameters #### Composer Package - **googleads/ad-manager** (string) - The package name to require. ### Request Example ```bash composer require googleads/ad-manager ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - .NET (CLI) Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the Google.Ads.AdManager.V1 NuGet package using the .NET CLI. ```APIDOC ## Set up your client library ### Method N/A (.NET CLI Package Management) ### Endpoint N/A ### Parameters #### .NET CLI Command - **dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01** - Command to add the specified NuGet package. ### Request Example ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - .NET (Package Reference) Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the Google.Ads.AdManager.V1 NuGet package as a package reference in your project file. ```APIDOC ## Set up your client library ### Method N/A (.NET Project Configuration) ### Endpoint N/A ### Parameters #### Package Reference - **Include** (string) - `Google.Ads.AdManager.V1` - **Version** (string) - `1.0.0-beta01` ### Request Example ```xml ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Node.js (package.json) Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the @google-ads/admanager package as a dependency in your package.json file. ```APIDOC ## Set up your client library ### Method N/A (package.json Configuration) ### Endpoint N/A ### Parameters #### package.json entry - **dependencies.@google-ads/admanager** (string) - The package name and version. ### Request Example ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Java (Gradle) Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the Ad Manager client library as a Gradle dependency. ```APIDOC ## Set up your client library ### Method N/A (Gradle Dependency Management) ### Endpoint N/A ### Parameters #### Gradle Dependency - **implementation** (string) - `'com.google.api-ads:ad-manager:0.1.0'` ### Request Example ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` ### Response N/A ``` -------------------------------- ### Client Library Setup - Java (Maven) Source: https://developers.google.com/ad-manager/api/beta/getting-started Add the Ad Manager client library as a Maven dependency in your pom.xml file. ```APIDOC ## Set up your client library ### Method N/A (Maven Dependency Management) ### Endpoint N/A ### Parameters #### Maven Dependency - **groupId** (string) - `com.google.api-ads` - **artifactId** (string) - `ad-manager` - **version** (string) - `0.1.0` ### Request Example ```xml com.google.api-ads ad-manager 0.1.0 ``` ### Response N/A ``` -------------------------------- ### Install Ad Manager Client Library for Ruby Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=ko This command installs the google-ads-ad_manager gem after it has been added to the Gemfile. ```bash gem install google-ads-ad_manager ``` -------------------------------- ### Install Ad Manager Client Library for Node.js Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=ko This command installs the @google-ads/admanager npm package for Node.js. ```bash npm install @google-ads/admanager ``` -------------------------------- ### Google Ad Manager API - Getting Started Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=vi This section details the initial setup required to use the Google Ad Manager API, including obtaining a network, enabling the API, and authenticating requests. ```APIDOC ## Getting Started with the Google Ad Manager API ### Description To use the Google Ad Manager API, you need to set up your environment and authenticate your requests. ### Setup Steps 1. **Obtain an Ad Manager network**: If you don't already have one, get a Google Ad Manager network. 2. **Enable the API**: In your Google API Console Project, enable the Google Ad Manager API. 3. **Authenticate requests**: Use OAuth2 for authentication. Set up Application Default Credentials (ADC) using environment variables or the `gcloud` command-line tool. 4. **Set up a client library**: Choose a client library for your preferred programming language using package managers such as Maven, pip, NuGet, Composer, RubyGems, or npm. ### Making Your First Request After setting up the client library, you can make your first request to retrieve network information: 1. **Create a client**: Instantiate a client object for the Ad Manager API. 2. **Form a request**: Construct a request to get your network details, providing your network code. 3. **Process the response**: Handle the API response, which will contain your network information. ``` -------------------------------- ### Getting Started with Google Ad Manager API (Beta) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=pt-br Steps to begin using the Google Ad Manager API, including accessing a network, enabling the API, and authentication. ```APIDOC ## Getting Started Use the Google Ad Manager API (Beta) to read your Ad Manager data and generate reports. To make your first API request, follow these steps: ### 1. Access an Ad Manager Network If you don't have one already, create an Ad Manager account. ### 2. Enable the Ad Manager API Enable the Ad Manager API in your Google API Console project. ### 3. Authenticate All API requests must be authenticated using OAuth2. The Ad Manager API client libraries read credentials from Application Default Credentials. You can set these values using environment variables or gcloud. #### Service Account Credentials User Credentials More ##### Linux or macOS ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ##### Windows ```cmd set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" # End user credentials must specify the cloud project where the API is enabled. gcloud auth application-default set-quota-project PROJECT_ID ``` For more information on choosing and creating credential types, see the authentication guide. ``` -------------------------------- ### Authentication using gcloud CLI Source: https://developers.google.com/ad-manager/api/beta/getting-started Authenticate using the gcloud CLI for user credentials and set the quota project. ```APIDOC ## Authenticate ### Method N/A (gcloud CLI Configuration) ### Endpoint N/A ### Parameters #### gcloud CLI Commands - **gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager"** - Command to log in with user credentials and specify the Ad Manager scope. - **gcloud auth application-default set-quota-project PROJECT_ID** - Command to set the quota project for your API requests. ### Request Example ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" gcloud auth application-default set-quota-project PROJECT_ID ``` ### Response N/A ``` -------------------------------- ### Getting Started with Google Ad Manager API Beta Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=pt-br This section outlines the initial steps required to use the Google Ad Manager API, including obtaining a network, enabling the API, and authenticating requests. ```APIDOC ## Getting Started with Google Ad Manager API Beta ### Description This guide covers the initial steps to begin using the Google Ad Manager API, including setting up your Ad Manager network and authenticating your API requests. ### Method N/A (Setup Guide) ### Endpoint N/A (Setup Guide) ### Parameters N/A (Setup Guide) ### Request Example N/A (Setup Guide) ### Response N/A (Setup Guide) ## Initial Setup Steps 1. **Obtain an Ad Manager Network**: Ensure you have an active Ad Manager network. 2. **Enable the API**: Enable the Google Ad Manager API within your Google API Console Project. 3. **Authenticate Requests**: Authenticate requests using OAuth2. Set up Application Default Credentials (ADC) by configuring environment variables or using `gcloud`. 4. **Set up Client Library**: Choose a client library for your preferred programming language (Java, Python, PHP, Ruby, .NET, Node.js) and install it using the respective package manager (Maven, pip, Composer, RubyGems, npm, NuGet). 5. **Make Your First Request**: Initiate your first API call to retrieve network information. This involves creating an API client, constructing a request with your network code, and handling the response. ``` -------------------------------- ### Authentication using Service Account Credentials (Linux/macOS) Source: https://developers.google.com/ad-manager/api/beta/getting-started Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account key file for authentication. ```APIDOC ## Authenticate ### Method N/A (Environment Variable Configuration) ### Endpoint N/A ### Parameters #### Environment Variables - **GOOGLE_APPLICATION_CREDENTIALS** (string) - Required - The file path to your service account key file. ### Request Example ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ### Response N/A ``` -------------------------------- ### Authentication using Service Account Credentials (Windows) Source: https://developers.google.com/ad-manager/api/beta/getting-started Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of your service account key file for authentication. ```APIDOC ## Authenticate ### Method N/A (Environment Variable Configuration) ### Endpoint N/A ### Parameters #### Environment Variables - **GOOGLE_APPLICATION_CREDENTIALS** (string) - Required - The file path to your service account key file. ### Request Example ```cmd set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ### Response N/A ``` -------------------------------- ### Getting Started with Google Ad Manager API (Beta) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=ko This section outlines the initial steps required to begin using the Google Ad Manager API (Beta). It covers obtaining access to your Ad Manager network, enabling the API within your Google Cloud project, and understanding authentication mechanisms. ```APIDOC ## Getting Started with Google Ad Manager API (Beta) Google Ad Manager API (Beta) allows you to read Ad Manager data and run reports. ### Steps to make your first API request: 1. **Obtain access to your Ad Manager network** * If you don't have an Ad Manager account, sign up for one. 2. **Enable Ad Manager API** * Enable the Ad Manager API in your Google API Console project. 3. **Authentication** * All API requests must be authenticated using OAuth2. * The Ad Manager API client libraries read credentials from Application Default Credentials. You can set these up using environment variables or `gcloud`. #### Setting up Credentials: **Using Environment Variables:** * **Linux or macOS:** ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` * **Windows:** ```cmd set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` **Using `gcloud`:** ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" # End user credentials must specify the cloud project where the API is enabled. gcloud auth application-default set-quota-project PROJECT_ID ``` * For more details on selecting credential types and creating credentials, refer to the authentication guide. 4. **Set up Client Libraries** * Client libraries are available for Java, Python, .NET, PHP, Ruby, and Node.js. **Java (Maven):** ```xml com.google.api-ads ad-manager 0.1.0 ``` **Java (Gradle):** ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` **Python:** ```bash pip install google-ads-admanager ``` **.NET:** * **CLI:** `dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01` * **Package Reference:** ```xml ``` **PHP:** ```bash composer require googleads/ad-manager ``` **Ruby:** * **Gemfile:** `gem 'google-ads-ad_manager', '~> 0.2.0'` * **Install:** `gem install google-ads-ad_manager` **Node.js:** * **Command Line:** `npm install @google-ads/admanager` * **Package.json:** ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### Add Ad Manager Client Library Dependency (Node.js) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=th These examples demonstrate how to add the Google Ad Manager client library for Node.js using npm and as a dependency in your package.json file. This enables integration with the Ad Manager API in Node.js applications. ```bash // From the command line: npm install @google-ads/admanager // Use as a package reference: // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` -------------------------------- ### Add Ad Manager Client Library Dependency (Ruby) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=th These snippets show how to add the Google Ad Manager client library to your Ruby project's Gemfile and install it. This facilitates the use of the Ad Manager API within Ruby applications. ```ruby # Gemfile: gem 'google-ads-ad_manager', '~> 0.2.0' # Install: gem install google-ads-ad_manager ``` -------------------------------- ### Setup Google Ad Manager API Client Libraries Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=tr Instructions and examples for setting up client libraries for the Google Ad Manager API using common package managers across different programming languages. Ensure you have the necessary development environment and package manager installed. ```bash # Example for Node.js (npm) npm install google-admanager-api ``` ```bash # Example for Python (pip) pip install google-admanager-api ``` ```bash # Example for Java (Maven) com.google.api google-admanager-api x.y.z ``` -------------------------------- ### Authenticate with Ad Manager API - gcloud CLI Source: https://developers.google.com/ad-manager/api/beta/getting-started These commands use the gcloud CLI to log in and set up application default credentials with the necessary scope for the Ad Manager API. It also sets the quota project for end-user credentials. ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" # End user credentials must specify the cloud project where the API is enabled. gcloud auth application-default set-quota-project PROJECT_ID ``` -------------------------------- ### Install and Setup Source: https://developers.google.com/ad-manager/api/beta/client-libraries/dotnet_hl=th Instructions on how to install the Google Ad Manager API client library for .NET using NuGet. ```APIDOC ## Install Google Ad Manager API Client Library for .NET ### Description Use the Google Ads Ad Manager client library to interact with the Ad Manager API. We recommend using the client library with NuGet. ### Package Reference (.NET CLI) ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` ### Package Reference (csproj) ```xml ``` ``` -------------------------------- ### Installation and Setup Source: https://developers.google.com/ad-manager/api/beta/client-libraries/dotnet_hl=pt-br Instructions for installing and adding the Google Ad Manager API .NET client library to your project using NuGet. ```APIDOC ## .NET Client Library Installation The Google Ad Manager API provides a .NET client library that can be used to interact with the API. It is recommended to use the client library with NuGet. ### Add Dependency to Project To start, create a new project in your integrated development environment (IDE) or add the dependency to an existing project. The client library artifacts are published to the NuGet repository as `Google.Ads.AdManager.V1`. **Using Visual Studio Project File (.csproj):** ```xml ``` **Using .NET CLI:** ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` ``` -------------------------------- ### Authenticate with gcloud CLI Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=th These commands use the gcloud command-line interface to log in and set up application default credentials for accessing Google Cloud services, including the Ad Manager API. It specifies the necessary OAuth2 scope and sets the quota project. ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" gcloud auth application-default set-quota-project PROJECT_ID ``` -------------------------------- ### Install Google Ads Ad Manager Client Library Source: https://developers.google.com/ad-manager/api/beta/client-libraries/python_hl=ko Instructions on how to install the Google Ads Ad Manager Python client library using pip. ```APIDOC ## Install Google Ads Ad Manager Client Library To use the Google Ads Ad Manager API with Python, you need to install the official client library. It is recommended to use the library with PyPI. ### Method `pip install` ### Command ```bash pip install google-ads-admanager ``` ### Description This command adds the `google-ads-admanager` package and its dependencies to your Python environment, allowing you to interact with the Ad Manager API. ``` -------------------------------- ### Making Your First Request (Get Network) Source: https://developers.google.com/ad-manager/api/beta/client-libraries/ruby_hl=it A practical example demonstrating how to make your first API request to get Network information using the Ruby client library. ```APIDOC ## Making Your First Request Each REST service has a corresponding Ruby class with methods for each corresponding REST method. The following example reads a `Network`. ```ruby require "google/ads/ad_manager/v1" def get_network # Create a client object. The client can be reused for multiple calls. client = Google::Ads::AdManager::V1::NetworkService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Ads::AdManager::V1::GetNetworkRequest.new(name: 'networks/NETWORK_CODE') # Call the get_network method. result = client.get_network request # The returned object is of type Google::Ads::AdManager::V1::Network. p result end get_network ``` For examples of other methods and resources, see the `googleapis/google-cloud-ruby` GitHub repository. ``` -------------------------------- ### Client Library Configuration Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=pt-br Instructions for setting up client libraries for various programming languages to use with the Ad Manager API. ```APIDOC ## Configure the Client Library ### Java For Maven: ```xml com.google.api-ads ad-manager 0.1.0 ``` For Gradle: ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` ### Python Install the client library from PyPi. ```bash pip install google-ads-admanager ``` ### .NET Install the client library on NuGet. On the .NET CLI: ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` As a package reference: ```xml ``` ### PHP Install the client library on Composer. ```bash composer require googleads/ad-manager ``` ### Ruby Install the client library on RubyGems. Gemfile: ```ruby gem 'google-ads-ad_manager', '~> 0.2.0' ``` Install: ```bash gem install google-ads-ad_manager ``` ### Node.js Install the client library from npm. On the command line: ```bash npm install @google-ads/admanager ``` As a package reference: ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### Getting Started with Ad Manager API (Beta) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=id This section outlines the essential steps to begin using the Ad Manager API (Beta). It covers obtaining access to an Ad Manager network, enabling the API in your Google Cloud project, authenticating requests, and setting up the necessary client libraries for your development environment. ```APIDOC ## Getting Started Use the Google Ad Manager API (Beta) to read Ad Manager data and run reports. To make your first API request, complete the following steps: ## Getting access to an Ad Manager network If you don't have one yet, sign up for an Ad Manager account. ## Enabling Ad Manager API Enable the Ad Manager API in your Google Cloud Console project. ## Authenticate All API requests must be authenticated using OAuth2. The Ad Manager API client libraries read credentials from Application Default Credentials. You can set them using environment variables or gcloud. ### Service Account ### User Credentials ### Other #### Linux or macOS ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` #### Windows ```cmd set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" # End user credentials must specify the cloud project where the API is enabled. gcloud auth application-default set-quota-project PROJECT_ID ``` For more information on how to choose credential types and create credentials, see the authentication guide. ## Setting up client libraries Java | Python | .NET | PHP | Ruby | Node.js | Other For Maven: ```xml com.google.api-ads ad-manager 0.1.0 ``` For Gradle: ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` Install the client library from PyPi. ```bash pip install google-ads-admanager ``` Install the client library from NuGet. From the .NET CLI: ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` As a package reference: ```xml ``` Install the client library from Composer. ```bash composer require googleads/ad-manager ``` Install the client library from RubyGems. Gemfile: ```ruby gem 'google-ads_ad_manager', '~> 0.2.0' ``` Installing: ```bash gem install google-ads_ad_manager ``` Install the client library from npm. From the command line: ```bash npm install @google-ads/admanager ``` As a package reference: ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### Add Ad Manager Client Library Dependency (.NET) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=th These examples show how to add the Google Ad Manager client library for .NET using the .NET CLI and as a PackageReference in project files. This enables you to use the Ad Manager API in your .NET applications. ```csharp // From the .NET CLI: dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 // Use as a package reference: ``` -------------------------------- ### Get Network Information with Ad Manager API (Ruby) Source: https://developers.google.com/ad-manager/api/beta/getting-started Demonstrates how to retrieve network details using the Ad Manager API's Ruby client library. This example initializes the Rest client, creates a GetNetworkRequest object with the network name, and then calls the get_network method. The result, an object of type Google::Ads::AdManager::V1::Network, is printed. ```ruby require "google/ads/ad_manager/v1" def get_network # Create a client object. The client can be reused for multiple calls. client = Google::Ads::AdManager::V1::NetworkService::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Ads::AdManager::V1::GetNetworkRequest.new(:name => 'networks/NETWORK_CODE') # Call the get_network method. result = client.get_network request # The returned object is of type Google::Ads::AdManager::V1::Network. p result end get_network ``` -------------------------------- ### Get Network API Source: https://developers.google.com/ad-manager/api/beta/getting-started This endpoint retrieves information about a specific network in Google Ad Manager. It requires the network's code to be specified in the request. ```APIDOC ## GET /v1/networks/{network_code} ### Description Retrieves information about a specific network in Google Ad Manager. ### Method GET ### Endpoint /v1/networks/{network_code} ### Parameters #### Path Parameters - **network_code** (string) - Required - The unique code identifying the network. ### Request Example ```bash curl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ https://admanager.googleapis.com/v1/networks/NETWORK_CODE ``` ### Response #### Success Response (200) - **name** (string) - The resource name of the network. - **networkCode** (string) - The code of the network. - **displayName** (string) - The display name of the network. #### Response Example ```json { "name": "networks/NETWORK_CODE", "networkCode": "NETWORK_CODE", "displayName": "Example Network Name" } ``` ``` -------------------------------- ### Client Library Setup - .NET (Package Reference) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for .NET using a package reference. ```APIDOC ## Configure Your Client Library ### .NET As a package reference: ```xml ``` ``` -------------------------------- ### Python Client for Ad Manager API Get Operation Status Source: https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.operations.reports.runs/get_hl=he Example of how to call the Ad Manager API to get the status of a long-running operation using Python. This code assumes you have the Google API client library for Python installed and authenticated. It constructs the request using the operation name and handles the response. ```python from googleapiclient.discovery import build # Replace with your actual operation name operation_name = "operations/your-operation-id" # Build the service object admanager_service = build('admanager', 'v1') try: # Call the API to get the operation status request = admanager_service.networks().operations().reports().runs().get(name=operation_name) operation = request.execute() print(operation) except Exception as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Client Library Setup - Ruby Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for Ruby using RubyGems. ```APIDOC ## Configure Your Client Library ### Ruby Install the client library from RubyGems. Gemfile: ```ruby gem 'google-ads-ad_manager', '~> 0.2.0' ``` Install: ```bash gem install google-ads-ad_manager ``` ``` -------------------------------- ### Getting Started with Ad Manager API (Beta) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=hi This section outlines the initial steps required to begin using the Ad Manager API, including accessing your Ad Manager network, enabling the API in your Google Cloud project, and understanding authentication methods. ```APIDOC ## Ad Manager Network Access If you do not already have an Ad Manager account, sign up for one. ## Enabling the Ad Manager API In your Google API Console project, enable the Ad Manager API. ## Authentication All API requests must be authenticated using OAuth2. The Ad Manager API client libraries read credentials from application default credentials, which can be set using an environment variable or gcloud. ### Service Account ### User Credentials More info #### Linux or macOS ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` #### Windows ```cmd set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ```bash gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager" # End user credentials must specify the cloud project where the API is enabled. gcloud auth application-default set-quota-project PROJECT_ID ``` For more details on choosing credential types and creating credentials, see the authentication guide. ## Setting Up Client Libraries Available for Java, Python, .NET, PHP, Ruby, Node.js, and more. ### Java For Maven: ```xml com.google.api-ads ad-manager 0.1.0 ``` For Gradle: ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` ### Python Install the client library from PyPi: ```bash pip install google-ads-admanager ``` ### .NET Install the client library from NuGet. Using .NET CLI: ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` As a package reference: ```xml ``` ### PHP Install the client library using Composer: ```bash composer require googleads/ad-manager ``` ### Ruby Install the client library from RubyGems. Gemfile: ```ruby gem 'google-ads-ad_manager', '~> 0.2.0' ``` Install: ```bash gem install google-ads-ad_manager ``` ### Node.js Install the client library using npm. From the command line: ```bash npm install @google-ads/admanager ``` As a package reference: ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### Client Library Setup - PHP Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for PHP using Composer. ```APIDOC ## Configure Your Client Library ### PHP Install the client library from Composer. ```bash composer require googleads/ad-manager ``` ``` -------------------------------- ### Curl Example for Getting Operation Status Source: https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.operations.reports.runs/get_hl=it An example using curl to make a GET request to the Ad Manager API to retrieve the status of a long-running operation. This showcases how to include the operation name in the URL. The example assumes proper authorization headers are set separately. ```bash curl -X GET \ 'https://admanager.googleapis.com/v1/operations/your_operation_name' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` -------------------------------- ### Set Google Application Credentials (Bash/Batch) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=th This snippet shows how to set the GOOGLE_APPLICATION_CREDENTIALS environment variable on Linux/macOS and Windows. This variable is used by client libraries to locate your service account key file for authentication. ```bash export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` ```batch set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH ``` -------------------------------- ### Client Library Setup - Python Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for Python using pip. ```APIDOC ## Configure Your Client Library ### Python Install the client library from PyPi. ```bash pip install google-ads-admanager ``` ``` -------------------------------- ### Get Started with Google Ad Manager API Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=vi This snippet provides a general overview of the steps required to begin using the Google Ad Manager API. It involves obtaining an Ad Manager network, enabling the API in Google API Console, authenticating requests with OAuth2, setting up client libraries, and making a sample request. No specific language is dictated here, as it describes a conceptual workflow. ```text To use the Google Ad Manager API, first, obtain an Ad Manager network and enable the API in your Google API Console Project. Authenticate requests via OAuth2, setting Application Default Credentials using environment variables or `gcloud`. Set up a client library using package managers like Maven, pip, NuGet, Composer, RubyGems, or npm for various languages. Finally, make your first request to retrieve a network by creating a client, forming a request with the network code, and processing the API response. ``` -------------------------------- ### Ad Manager API Authentication Setup (JSON) Source: https://developers.google.com/ad-manager/api/beta/migration_hl=bn This JSON configuration is used for setting up Ad Manager API authentication using installed application credentials. It requires replacing placeholder values with your actual client ID, client secret, and refresh token. This setup is crucial for applications needing to authenticate with the Ad Manager API (Beta). ```json { "client_id": "CLIENT_ID", "client_secret": "CLIENT_SECRET", "refresh_token": "REFRESH_TOKEN", "type": "authorized_user" } ``` -------------------------------- ### Client Library Setup Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=fa Instructions for setting up client libraries for the Ad Manager API (Beta) in Java, Python, .NET, PHP, Ruby, and Node.js. ```APIDOC ## Setting up your client library ### Java For Maven: ```xml com.google.api-ads ad-manager 0.1.0 ``` For Gradle: ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` ### Python Install the client library from PyPi. ```bash pip install google-ads-admanager ``` ### .NET Install the client library from NuGet. From the .NET CLI: ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` As a PackageReference: ```xml ``` ### PHP Install the client library from Composer. ```bash composer require googleads/ad-manager ``` ### Ruby Install the client library from RubyGems. Gemfile: ```ruby gem 'google-ads-ad_manager', '~> 0.2.0' ``` Install: ```bash gem install google-ads-ad_manager ``` ### Node.js Install the client library from npm. From the command line: ```bash npm install @google-ads/admanager ``` As a package dependency: ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### Client Library Setup - Java (Gradle) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for Java using Gradle. ```APIDOC ## Configure Your Client Library ### Java For Gradle: ```gradle implementation 'com.google.api-ads:ad-manager:0.1.0' ``` ``` -------------------------------- ### Make Your First Request: Get Network Information (Synchronous) Source: https://developers.google.com/ad-manager/api/beta/client-libraries/python_hl=ko A Python code example demonstrating how to make a synchronous request to retrieve network information using the Ad Manager API client library. ```APIDOC ## Make Your First Request: Get Network Information (Synchronous) Each service within the client library provides a `ServiceClient` object with both synchronous and asynchronous methods for its REST endpoints. This example shows how to synchronously retrieve network details. ### Method Synchronous GET request ### Endpoint `NetworkServiceClient.get_network` ### Request Body ```json { "name": "networks/[NETWORK_CODE]" } ``` ### Request Example ```python from google.ads import admanager_v1 def sample_get_network(): # Create a client client = admanager_v1.NetworkServiceClient() # Initialize request argument(s) request = admanager_v1.GetNetworkRequest( name="networks/[NETWORK_CODE]", ) # Make the request response = client.get_network(request=request) # Handle the response print(response) # To run this sample, replace '[NETWORK_CODE]' with your actual Ad Manager network code. sample_get_network() ``` ### Response #### Success Response (200) The response will contain details about the Ad Manager network, such as its ID, display name, and currency. #### Response Example ```json { "name": "networks/1234567890", "display_name": "Example Network Name", "currency_code": "USD", "தல்_country_code": "US", "timezone_id": "America/Los_Angeles" } ``` For examples of other methods and resources, refer to the `googleapis/google-cloud-python` GitHub repository. ``` -------------------------------- ### Client Library Setup - .NET (CLI) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for .NET using the .NET CLI. ```APIDOC ## Configure Your Client Library ### .NET Install the client library from NuGet. From the .NET CLI: ```bash dotnet add package Google.Ads.AdManager.V1 --version 1.0.0-beta01 ``` ``` -------------------------------- ### Google API Client Library - Python Example for Get Operation Status Source: https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.operations.reports.runs/get_hl=bn Example demonstrating how to use a Google API client library (Python) to get the status of a long-running operation in Ad Manager. This requires the 'google-api-python-client' library and appropriate authentication. ```python from googleapiclient.discovery import build from google.oauth2 import service_account # Authentication setup (replace with your actual credentials) SCOPES = ['https://www.googleapis.com/auth/admanager'] SERVICE_ACCOUNT_FILE = 'path/to/your/service_account.json' creds = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES) # Build the Ad Manager service client admanager_service = build('admanager', 'v1', credentials=creds) # Operation name (replace with your actual operation name) operation_name = 'operations/your-operation-id' try: # Get the operation status operation = admanager_service.networks().operations().reports().runs().get( name=operation_name ).execute() print(f"Operation Status: {operation.get('done')}") if operation.get('done'): print(f"Operation Result: {operation.get('response')}") else: print("Operation is still in progress...") except Exception as e: print(f"An error occurred: {e}") ``` -------------------------------- ### Client Library Setup - Java (Maven) Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for Java using Maven. ```APIDOC ## Configure Your Client Library ### Java For Maven: ```xml com.google.api-ads ad-manager 0.1.0 ``` ``` -------------------------------- ### Client Library Setup - Node.js Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=es Instructions for setting up the Ad Manager API client library for Node.js using npm. ```APIDOC ## Configure Your Client Library ### Node.js Install the client library from npm. From the command line: ```bash npm install @google-ads/admanager ``` As a package reference: ```json // package.json "dependencies": { "@google-ads/admanager": "^0.1.0" } ``` ``` -------------------------------- ### HTTP GET Request Example Source: https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.cmsMetadataValues/get_hl=pt-br Example of an HTTP GET request to retrieve a CmsMetadataValue. This request targets the Ad Manager API Beta endpoint and requires the resource name as a path parameter. ```http GET https://admanager.googleapis.com/v1/{name} --- `name` | `string` Required. The resource name of the CmsMetadataKey. Format: `networks/{networkCode}/cmsMetadataValues/{cmsMetadataValueId}` ``` -------------------------------- ### Get Network Information with Ad Manager API (PHP) Source: https://developers.google.com/ad-manager/api/beta/getting-started Illustrates fetching network details using the Ad Manager API's PHP client library. This code sets up the NetworkServiceClient, prepares a GetNetworkRequest with the formatted network name, and makes the API call within a try-catch block to handle potential ApiException errors. The output is serialized to JSON. ```php setName($formattedName); // Call the API and handle any network failures. try { /** @var Network $response */ $response = $networkServiceClient->getNetwork($request); printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); } catch (ApiException $ex) { printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); } } /** * Helper to execute the sample. * */ function callSample(): void { $formattedName = NetworkServiceClient::networkName('NETWORK_CODE'); get_network_sample($formattedName); } callSample(); ``` -------------------------------- ### API Request with Authorization Header Source: https://developers.google.com/ad-manager/api/beta/authentication This example demonstrates how to make a GET request to the Ad Manager API using an `Authorization` HTTP header with a `Bearer` token. This method is preferred over query parameters for security reasons, as it avoids exposing the token in server logs. ```http GET /v1/networks/1234 Host: admanager.googleapis.com Authorization: Bearer ya29.a0Ad52N3_shYLX ``` -------------------------------- ### Set up Ad Manager API Client Libraries Source: https://developers.google.com/ad-manager/api/beta/getting-started_hl=hi Instructions for setting up client libraries for the Google Ad Manager API using various package managers. This enables programmatic interaction with the Ad Manager service. ```bash # Maven mvn install # pip pip install google-ads # NuGet Install-Package Google.Ads.GoogleAds # Composer composer require googleads/google-ads-php # RubyGems gem install google-ads-googleads # npm npm install google-ads ```