The abstract base class for all Google Ads API services, e.g. CampaignService, AdGroupService, etc.


  use Google::Ads::GoogleAds::Client;

  my $api_client = Google::Ads::GoogleAds::Client->new({version => "V3"});

  my $campaign_service = $api_client->CampaignService();


Each service instance is initialized by Google::Ads::GoogleAds::Client, and these attributes are set automatically.

Alternatively, there is a get_ and set_ method associated with each attribute for retrieving or setting them dynamically.

  my %api_client_of : ATTR(:name<api_client> :default<>);


A reference to the Google::Ads::GoogleAds::Client, holding the API credentials and configurations.



Sends REST HTTP requests to Google Ads API server and handles the responses.


  • http_method: The HTTP request method, e.g. GET, POST.

  • request_path: The relative request URL which may contain wildcards to expand, e.g. {+resourceName}, {+customerId}.

  • request_body: A Perl object representing the HTTP request payload, which will be used to expand the {+resourceName} or any other expression in the request path and encoded into JSON string for a HTTP POST request.

  • response_type: The class name of the expected response. An instance of this class will be returned if the request succeeds.

  • content_callback: The optional streaming content callback method.


An instance of the class defined by the response_type parameter, or a Google::Ads::GoogleAds::GoogleAdsException object if an error has occurred at the server side by default. However if the die_on_faults flag is set to true in Google::Ads::GoogleAds::Client, the service will issue a die() with error message on API errors.


Prepare the basic HTTP request headers including Content-Type, user-agent, developer-token and login_customer_id - if needed. The headers will be consolidated with access token in the method of "prepare_request" in Google::Ads::GoogleAds::Common::OAuth2BaseHandler.


The basic HTTP headers including Content-Type, user-agent, developer-token and login_customer_id - if needed.


Copyright 2019 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

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.


 $Rev: $
 $LastChangedBy: $
 $Id: $