The Perl Client Library

  • The Perl client library for the Google Ads API is hosted on GitHub and available on CPAN, supporting Perl version 5.28.1 or greater.

  • This client library uses the JSON REST protocol over HTTP 1.1 to communicate with the Google Ads API, as Perl is not a supported language for the gRPC interface.

  • The client library generates class entities by parsing protocol buffer definitions and handles serialization and deserialization of data using JSON.

  • Resources are available for getting started with the library and obtaining OAuth2 tokens using different application flows or service accounts.

The Perl client library is hosted on GitHub, and the package is available on CPAN.

The library supports Perl version 5.28.1 or greater.

REST API protocol

Class entities—such as service, resource, enum, and error—in the Perl client library are generated by parsing the protocol buffer definitions. To learn more about how structured data is serialized, refer to the protocol buffer documentation.

To connect with the Google Ads API, the client library creates an HTTP request in JSON, sends it to the REST endpoint over HTTP 1.1, deserializes the response as a JSON object, and interprets the results.

Install the library

The Perl client library is hosted on GitHub and distributed using CPAN.

  1. Clone the library from GitHub:

    git clone https://github.com/googleads/google-ads-perl.git
    
  2. Change into the google-ads-perl directory:

    cd google-ads-perl
    

    You'll see some files and subdirectories:

    • Build.PL: the Perl build file, which holds the dependencies and test types of this project.
    • lib: source code of the library.
    • t: test cases of the library code.
    • examples: many examples that demonstrate how to use the library to execute common use cases using the Google Ads API.
    • googleads.properties: the sample configuration file for the library.
    • log4perl.conf: the sample logging configuration file.
  3. Install the required dependencies. The Build.PL file lists all the dependencies required for the library. You can install them by running the following commands:

    cpan install Module::Build
    perl Build.PL
    perl Build installdeps
    

Make your first API call

To use the Google Ads API, you need to perform several steps to get access to the API and configure your Google Ads accounts. We recommend following the quick start guide, which will walk you through all the important steps including setting up your Google Ads accounts.

Basic usage

Refer to the basic usage guide to learn more about how to use the Perl client library.

Authentication and authorization

The Perl client library supports multiple approaches to authentication and authorization. Refer to the Authentication and Authorization guide to learn more.

Configuration and logging

The Perl client library uses googleads.properties for configuration and log4perl.conf for logging. You can modify these files to customize the library's behavior. Refer to the Logging guide to learn more.

Utilities

The Perl client library includes a few utility classes to improve the API usability. Refer to the following guides to learn more:

Fine-tune your application performance

Refer to the Performance guide for recommendations on how to fine-tune your application's performance.