Hello,

when trying to use Net::Google::WebmasterTools I am getting the following error:

https://www.googleapis.com/webmasters/v3/sites/https://www.mySite.com/ +searchAnalytics/query GWMT error: 404 Not Found Not Found at ./Google_Search_Console_API.pl +line 43, <DATA> line 2231.
Here the used script (the credentials in this example like $client_id, $client_secret and $refresh_token have been certainly substituted by my own credentials).
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Net::Google::WebmasterTools; use Net::Google::WebmasterTools::OAuth2; # Insert your website URL here. my $site_url = "https://www.mySite.com"; # See GETTING STARTED for how to get a client id, client secret, and # refresh token my $client_id = "123456789012.apps.googleusercontent.com"; my $client_secret = "rAnDoMsEcReTrAnDoMsEcReT"; my $refresh_token = "RaNdOmSeCrEtRaNdOmSeCrEt"; my $wmt = Net::Google::WebmasterTools->new; # Authenticate my $oauth = Net::Google::WebmasterTools::OAuth2->new( client_id => $client_id, client_secret => $client_secret, ); my $token = $oauth->refresh_access_token($refresh_token); $wmt->token($token); # Build request my $req = $wmt->new_request( site_url => "$site_url", report_name => "searchAnalytics", method => "query", dimensions => ['country','device'], search_type => 'web', start_date => "2016-07-01", end_date => "2016-07-20", row_limit => 1000, ); # Send request my $res = $wmt->retrieve($req); die("GWMT error: " . $res->error_message) if !$res->is_success; # Print results print "Results: 1 - ", $res->items_per_page, " of ", $res->total_results, "\n\n"; for my $row (@{ $res->rows }) { print $row->get_source, ": ", $row->get_visits, " visits, ", $row->get_bounces, " bounces\n"; } print "\nTotal: ", $res->totals("visits"), " visits, ", $res->totals("bounces"), " bounces\n";

Any ideas what might be wrong?

Best regards, Frosch

In reply to Net::Google::WebmasterTools: GWMT error: 404 Not Found by Frosch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.