ReportDownloadError.INVALID_PARAMETER

1,041 views
Skip to first unread message

Dhiraj Shinde

unread,
Jul 15, 2014, 11:43:42 AM7/15/14
to adwor...@googlegroups.com
Hi All,
         I am working on project which need some Google ad-word API usage, actually i need to download campaign_performance_report for my client for particular date, using the following script
 
  my $mech = WWW::Mechanize->new();
  $mech->add_header({
clientCustomerId => "xxx-xxx-xxxx",#valid client customer id
'Authorization: Bearer' =>'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',#my access token with scope manage adword campaign
developerToken => 'xxxxxxxxxxxxxxxxxxx'});
{ __rdquery => 'SELECT+CampaignName+CampaignId+Cost+FROM+CAMPAIGN_PERFORMANCE_REPORT+DURING+20140619,20140619',__fmt => 'CSV'
}
);

when i see the response of above request i got 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>ReportDownloadError.INVALID_PARAMETER</type><trigger>Missing client information</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>

i am following approach mentioned in the link

i don't understand what exactly is missing ?
need help from expert 

Anash P. Oommen (AdWords API Team)

unread,
Jul 15, 2014, 3:08:03 PM7/15/14
to adwor...@googlegroups.com
Hi Dhiraj,

Just wondering, shouldn't this be Authorization => 'Bearer xxx'? You can see how the headers should look like at https://developers.google.com/adwords/api/docs/guides/reporting

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Dhiraj Shinde

unread,
Jul 18, 2014, 7:38:08 AM7/18/14
to adwor...@googlegroups.com
HI Anash,
              Thanks for your reply, actually initially i used it like you mentioned only i.e Authorization => 'Bearer xxx' but later when it started giving error, i did some trial and error so i send you that code.
following is the latest code of mine 

  use WWW::Mechanize;

my $mech = WWW::Mechanize->new();
$mech->add_header(
{
'userAgent' => 'adwordreporting.com:ReportDownloader:V7.18',
'Authorization' =>
'Bearer xxxxxxxxxxxxxxxx',
'developerToken'   => 'xxxxxxxxxxxxxxxxxxxx',
'clientCustomerId' => 'xxx-xxx-xxxx',
'partialFailure'   => 1 
}
);
eval {
{
__rdquery =>
'SELECT+CampaignName+CampaignId+Cost+FROM+CAMPAIGN_PERFORMANCE_REPORT+DURING+20140619,20140619',
__fmt => 'CSV',
}
);
};
if ($@) {
print $@;
}

print Dumper $mech;
print Dumper $response->decoded_content();

let me know what exactly i am missing ?
is my user-agent correct i saw doc and accordingly added that.

Josh Radcliff (AdWords API Team)

unread,
Jul 18, 2014, 5:55:08 PM7/18/14
to adwor...@googlegroups.com
Hi,

As far as I can tell, the only way you can get ReportDownloadError.INVALID_PARAMETER - Missing client information is if you do not populate the clientCustomerId header. From your code snippet, however, it looks like you are populating it. Can you enable more logging or send the output from print Dumper $mech after removing any sensitive information?

Also, have you considered using one of our client libraries? Once you set up the configuration file for each library, it takes care of all of the complexities of setting headers, obtaining access tokens, etc. Each library also has a helper class for downloading reports, e.g., Perl's helper is here with accompanying docs, and there are code examples that show how to use it here.

Cheers,
Josh, AdWords API Team

Dhiraj Shinde

unread,
Jul 21, 2014, 4:51:48 AM7/21/14
to adwor...@googlegroups.com
$VAR1 = bless( {
                 'ssl_opts' => {
                                 'verify_hostname' => 1
                               },
                 'res' => bless( {
                                   '_protocol' => 'HTTP/1.1',
                                   '_content' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>ReportDownloadError.INVALID_PARAMETER</type><trigger>Missing client information</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>',
                                   '_rc' => 400,
                                   '_headers' => bless( {
                                                          'connection' => 'close',
                                                          'cache-control' => 'private, max-age=0',
                                                          'date' => 'Mon, 21 Jul 2014 07:39:35 GMT',
                                                          'client-ssl-cert-issuer' => '/C=US/O=Google Inc/CN=Google Internet Authority G2',
                                                          'client-ssl-cipher' => 'xxxxx-xxx-xxxxxx-xxx',
                                                          'client-peer' => 'xx.xx.xx.xx:443',
                                                          'client-date' => 'Mon, 21 Jul 2014 07:39:35 GMT',
                                                          'content-type' => 'text/xml',
                                                          'x-xss-protection' => '1; mode=block',
                                                          'server' => 'GSE',
                                                          'client-ssl-socket-class' => 'IO::Socket::SSL',
                                                          'client-response-num' => 1,
                                                          'x-frame-options' => 'SAMEORIGIN',
                                                          'x-content-type-options' => 'nosniff',
                                                          'client-ssl-cert-subject' => '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com',
                                                          'expires' => 'Mon, 21 Jul 2014 07:39:35 GMT'
                                                        }, 'HTTP::Headers' ),
                                   '_msg' => 'Bad Request',
                                   '_request' => bless( {
                                                          '_content' => '__rdquery=SELECT%2BCampaignName%2BCampaignId%2BCost%2BFROM%2BCAMPAIGN_PERFORMANCE_REPORT%2BDURING%2B20140619%2C20140619&__fmt=CSV',
                                                          '_uri' => bless( do{\(my $o = 'https://adwords.google.com/api/adwords/reportdownload/v201406')}, 'URI::https' ),
                                                          '_headers' => bless( {
                                                                                 'user-agent' => 'WWW-Mechanize/1.72',
                                                                                 'content-type' => 'application/x-www-form-urlencoded',
                                                                                 'accept-encoding' => 'gzip',
                                                                                 'content-length' => 129
                                                                               }, 'HTTP::Headers' ),
                                                          '_method' => 'POST',
                                                          '_uri_canonical' => $VAR1->{'res'}{'_request'}{'_uri'}
                                                        }, 'HTTP::Request' )
                                 }, 'HTTP::Response' ),
                 'page_stack' => [],
                 'requests_redirectable' => [
                                              'GET',
                                              'HEAD',
                                              'POST'
                                            ],
                 'timeout' => 180,
                 'onerror' => sub { "DUMMY" },
                 'links' => undef,
                 'base' => bless( do{\(my $o = 'https://adwords.google.com/api/adwords/reportdownload/v201406')}, 'URI::https' ),
                 'images' => undef,
                 'noproxy' => 0,
                 'show_progress' => undef,
                 'protocols_forbidden' => undef,
                 'no_proxy' => [],
                 'protocols_allowed' => undef,
                 'use_eval' => 1,
                 'local_address' => undef,
                 'autocheck' => 1,
                 'title' => undef,
                 'def_headers' => bless( {
                                           'user-agent' => 'WWW-Mechanize/1.72'
                                         }, 'HTTP::Headers' ),
                 'proxy' => {},
                 'max_size' => undef,
                 'headers' => {
                                'HASH(0xa63b65c)' => undef
                              },
                 'req' => $VAR1->{'res'}{'_request'},
                 'status' => '400',
                 'forms' => undef,
                 'ct' => 'text/xml',
                 'redirected_uri' => 'https://adwords.google.com/api/adwords/reportdownload/v201406',
                 'text' => undef,
                 'current_form' => undef,
                 'quiet' => 0,
                 'max_redirect' => 7,
                 'stack_depth' => 8675309,
                 'handlers' => {
                                 'request_prepare' => bless( [
                                                               {
                                                                 'owner' => 'LWP::UserAgent::cookie_jar',
                                                                 'callback' => sub { "DUMMY" },
                                                                 'line' => '/usr/local/share/perl/5.14.2/LWP/UserAgent.pm:704'
                                                               }
                                                             ], 'HTTP::Config' ),
                                 'response_header' => bless( [
                                                               {
                                                                 'owner' => 'LWP::UserAgent::parse_head',
                                                                 'callback' => sub { "DUMMY" },
                                                                 'm_media_type' => 'html',
                                                                 'line' => '/usr/local/share/perl/5.14.2/LWP/UserAgent.pm:683'
                                                               }
                                                             ], 'HTTP::Config' ),
                                 'response_done' => bless( [
                                                             {
                                                               'owner' => 'LWP::UserAgent::cookie_jar',
                                                               'callback' => sub { "DUMMY" },
                                                               'line' => '/usr/local/share/perl/5.14.2/LWP/UserAgent.pm:707'
                                                             }
                                                           ], 'HTTP::Config' )
                               },
                 'onwarn' => sub { "DUMMY" },
                 'cookie_jar' => bless( {
                                          'COOKIES' => {}
                                        }, 'HTTP::Cookies' )
               }, 'WWW::Mechanize' );

This is the dump of Mech object which i tried , also i tried using other approach that is using library of Perl 

here is the content of adword properties file for libraries with credential as xxxxxxxxxxxxxx
# for an overview of header information.

# A string of your choosing, used to identify your application.
userAgent=xxxx.com:ReportDownloader:V7.18

# A 22 character Developer Token.
developerToken=xxxxxxxxxxxxxxxxxxxxxx

# To use an alternative URL in case you want to manually proxy your requests
# or fake the API servers.

# The Client Customer ID of the client account your application will access.
# This can be programmatically set in the Client object as
# $client->set_client_id
clientId=xxx-xxx-xxxx

### Peer verification of SSL certificates ###
#
# To avoid spoofing attacks, enable either a CAPath or CAFile for SSL
# certificates validation.
#
# This library can use two different underlying SSL modules either
# IO::Socket::SSL or Crypt::SSLeay, being IO::Socket::SSL the default and
# recommended since it can do certificate authenticity validation as well as
# hostname validation while Crypt::SSLeay does not support hostname validation.

# The certificate authority directory to search in when performing peer
# validation. For example: /etc/ssl/certs
# CAPath=<PATH TO CERTIFICATE AUTHORITY DIRECTORY>

# The certificate authority file to use when performing peer validation.
# For example: /etc/ssl/certs/ca-certificates.crt
# CAFile=<PATH TO CERTIFICATE AUTHORITY FILE>

### Authorization Mechanisms ###
#
# The library supports the OAuth2, OAuth1.0a and ClientLogin mechanisms. Need to
# choose one, un-comment and fill in its details.
#
# More details about authorization options supported by the library can be found
# in the README, section "Authorization Options".
#
# Also to learn more about API authorization please visit

### OAuth2 ###

# Un-comment the following keys to use OAuth 2 authorization.
# All these values are found in the Google API Console.
#

# For the Web/Installed Applications flow, un-comment the following.
#
oAuth2ClientSecret=xxxxxxxxxxxxxxxxxxxxxxxx
#
# Then you need one of the following two options.
#
# Option 1: un-comment the following if you already have OAuth2 authorization
# tokens.
oAuth2AccessToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oAuth2RefreshToken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#
# Option 2: Use the library to trigger the authorization flow and have the
# user authorize access to his account. See the
# examples/oauth/generate_offline_credentials.pl to learn how to use the
# library for requesting user authorization.
#
# Optionally, un-comment the following if you want to change defaults for the
# user interaction flow.
# Default offline
# oAuth2AccessType=[online|offline]
# Default auto
# oAuth2ApprovalPrompt=[force|auto]
# Defaults to urn:ietf:wg:oauth:2.0:oob
# oAuth2RedirectUri=INSERT_REDIRECT_URI_HERE

# For the Service Accounts flow, un-comment the following.
#
# In order to user the library for service accounts you need to transform your
# p12 certificate as generated by the Google API Console to PEM format. And make
# sure no password is set.
# In Linux/Unix systems with openssl installed you can execute.
# > openssl pkcs12 -in {private-key}.p12 -out {private-key}.pem -nodes
#
# oAuth2ServiceAccountEmailAddress=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# oAuth2ServiceAccountDelegateEmail=INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE
# oAuth2ServiceAccountPEMFile=INSERT_PATH_TO_YOUR_CERTIFICATE_FILE_HERE

### OAuth1 ###

# Notice this authorization method is already deprecated and OAuth2 should be
# used in preference.

# Un-comment the following to use OAuth 1.0a as authorization method.
# oAuthConsumerKey=INSERT_OAUTH_CONSUMER_KEY_HERE
# oAuthConsumerSecret=INSERT_OAUTH_CONSUMER_SECRET_HERE
# oAuthDisplayName=OPTIONAL_INSERT_OAUTH_DISPLAY_NAME_HERE

# Optionally: un-comment the following if you already have OAuth 1.0a authorization tokens.
# oAuthToken=INSERT_OAUTH_TOKEN_HERE
# oAuthTokenSecret=INSERT_OAUTH_TOKEN_SECRET_HERE

### ClientLogin ###

# Notice this authorization method is already deprecated and OAuth2 should be
# used in preference.

# Un-comment the following to use ClientLogin
# email=INSERT_LOGIN_EMAIL_HERE
# password=INSERT_PASSWORD_HERE

# Or set the following to use an existing AuthToken.
# This is optional, and if set email and password will not be used.
# authToken=INSERT_AUTH_TOKEN_HERE

using that i got error as follows
The library couldn't find any authorization mechanism set up to properly sign the requests against the API. Please read the following guide on how to setup OAuth2 https://github.com/googleads/googleads-perl-lib/wiki/Using-OAuth-2.0 at ../../../lib/Google/Ads/Common/HTTPTransport.pm line 47.

Josh Radcliff (AdWords API Team)

unread,
Jul 21, 2014, 11:56:37 AM7/21/14
to adwor...@googlegroups.com
Hi,

As the dump of the Mech object shows, you do not have an Authorization header as specified in the OAuth2 guide.


                                                          '_headers' => bless( {
                                                                                 'user-agent' => 'WWW-Mechanize/1.72',
                                                                                 'content-type' => 'application/x-www-form-urlencoded',
                                                                                 'accept-encoding' => 'gzip',
                                                                                 'content-length' => 129
                                                                               }, 'HTTP::Headers' ),
I'm not an expert on Mech, but it seems that your calls aren't setting the headers as expected.
 
Regarding the error from Perl:

using that i got error as follows
The library couldn't find any authorization mechanism set up to properly sign the requests against the API. Please read the following guide on how to setup OAuth2 https://github.com/googleads/googleads-perl-lib/wiki/Using-OAuth-2.0 at ../../../lib/Google/Ads/Common/HTTPTransport.pm line 47.

1. How are you constructing your Client object? Are you using the same approach we use in the download_criteria_report.pl example?
2. Have you tried running the download_criteria_report.pl example?
3. Is your adwords.properties file in your home directory?

Thanks,
Josh, AdWords API Team
 

Dhiraj Shinde

unread,
Jul 21, 2014, 12:26:35 PM7/21/14
to adwor...@googlegroups.com
i am setting client object like follows
my $client = Google::Ads::AdWords::Client->new(
{
version         => 'v201406',
properties_file =>
"/home/dhiraj/perl/GOOGLE-ADWORDS-PERL-CLIENT-2.16.0/adwords.properties",
}
);

adword.properties file contain all info as i told you in my prev post and when i tried running the script and for 

download_criteria_report.pl it is showing error as follows

{
  "error" : "invalid_client",
  "error_description" : "The OAuth client was not found."
} at ../../../lib/Google/Ads/Common/OAuth2ApplicationsHandler.pm line 127.
Can't call method "isa" on an undefined value at ../../../lib/Google/Ads/Common/ReportUtils.pm line 74.


On Tuesday, July 15, 2014 9:13:42 PM UTC+5:30, Dhiraj Shinde wrote:

Josh Radcliff (AdWords API Team)

unread,
Jul 21, 2014, 2:28:59 PM7/21/14
to adwor...@googlegroups.com
Hi,

Let's try to keep things as straightforward as possible. Could you:

1. Copy your adwords.properties file to your home directory.
2. Change your constructor call to simply:
    my $client = Google::Ads::AdWords::Client->new();
3. Try the example again.

Thanks,
Josh, AdWords API Team

swamy GVVSS

unread,
Aug 8, 2016, 3:43:32 PM8/8/16
to AdWords API Forum
Hi Josh,


I am trying to download the ACCOUNT_PERFORMANCE_REPORT from Adwords API. I have all the information to make a session with API. But the problem was I am having 800+ client customer id s to pass. Is there any alternate way to download the report for all the client Ids in a single shot. Thanks In Advance.

Josh Radcliff (AdWords API Team)

unread,
Aug 8, 2016, 3:47:34 PM8/8/16
to AdWords API Forum
Hi,

Each AdWords API request can only be issued against a single customer account (see the Reporting guide).

However, we do have an opensource project that makes it easy to automate issuing requests for each account under your manager account. Check out the aw-reporting project for more details.

Thanks,
Josh, AdWords API Team

P.S. Going forward, please post a new topic if your question is not directly related to an existing topic. This makes it easier for others who are searching the group, and makes it easier for everyone to follow the replies on each topic.
Reply all
Reply to author
Forward
0 new messages