Monday, November 8, 2021

Bump version to 0.15

Hi, I uploaded version 0.15 to CPAN.

This version is included following pull requests.

By #28, discovery URL template was changed like below.

  • 0.14 or earlier: https://www.googleapis.com/discovery/v1/apis/{api}/{apiVersion}/rest
  • 0.15: https://{api}.googleapis.com/$discovery/rest?version={apiVersion}

This version will not be affected by this change.

If you have any questions or suggestions, please feel free let me know or create an issue on GitHub.

Saturday, October 18, 2014

Bump version to 0.14

Update
: I'm implementing new version 0.15. Please wait for a while. Sorry for the inconvenience.



Hello, I merged following pull requests. Thank you for your contributions, razsh, richieforeman and ljanvier.



By #14, redirect_uri parameter is not required. It related to Cross-client authorizetion.


By #15, we can use Signed JWT. See also: Using OAuth 2.0 for Server to Server Applications.


#16 may be affected your application. Before this change, if an API returns 204 (No Content), execute method returned undef. After this change, execute method returns 1 in 204 response.


These updates will be uploaded CPAN soon.


If you have any questions or suggestions, please feel free let me know or create an issue on GitHub.


Thanks!

Tuesday, November 26, 2013

0.13 has been released

Hello, I uploaded Google::API::Client 0.13 to CPAN right now.

I merged pull request #12 from chylli. Thank you for your contribution!

So far, Google::API::OAuth2::Client supports parameters both approval_prompt and access_type. (see also: Using OAuth 2.o for Web Server Application)

If you have any suggestions or contributions, please feel free let me know or send pull requests.

Thanks!

Saturday, November 23, 2013

CPAN!

Hello, I uploaded Google::API::Client to CPAN!

http://search.cpan.org/dist/Google-API-Client/

via cpanm
cpanm Google::API::Client

via Carton, you will write below in cpanfile
requires 'Google::API::Client', 0.12;
or, you can try latest version like below.
requires 'Google::API::Client';

Currently, I am trying to write PhotoHunt application written in Perl like here.

Then, probably I will update Google::API::Client more convenient for you. Stay tuned!

Thanks!

Saturday, November 9, 2013

Google::API::Client 0.10 has been released

Hello,

I've just updated Google::API::Client to 0.10.

Tagged at GitHub: https://github.com/comewalk/google-api-perl-client/releases/tag/0.10

Although I announced in previous post, I renamed OAuth2 module from OAuth2::Client to Google::API::OAuth2::Client.
If you are using this module, and if you will update your environment, please change your code.
Thank you for your patience.

And I uploaded 0.10 to CPAN! (Currently the module is not available)

I will let you know Google::API::Client is available on CPAN.

Thanks!

Wednesday, November 6, 2013

Preparing upload to CPAN

Hello,

I received the request several times, upload this module to CPAN. In these day, in Perl world, cpanm and Carton are useful tools for installing modules. And these tools use CPAN. I think it's time to upload this module to CPAN.

I filed an issue on GitHub below.
https://github.com/comewalk/google-api-perl-client/issues/8

Also, it includes important changes. My module has OAuth2::Client. But I think it's not good namespace for CPAN world. I should rename the module to Google::API::OAuth2::Client. I filed it at #9.
https://github.com/comewalk/google-api-perl-client/issues/9

Both of them will be solved soon.

I will let you know after fixing them and uploading to CPAN here and mailing list.

Thanks!

Friday, August 3, 2012

Updated to 0.07

Unfortunatelly, this module didn't work update methods, POST / PUT / PATCH / DELETE. So far, it works well :)


You can see a sample like below.

$ git clone https://github.com/comewalk/google-api-perl-client.git
$ cd google-api-perl-client
$ cat eg/calendar/events.pl
# QuickAdd
say '=== QuickAdd ===';
my $quickadded_event = $service->events->quickAdd(
    calendarId => $calendar_id,
    text => 'Appointment at Somewhere on June 3rd 10am-10:25am',
)->execute({ auth_driver => $auth_driver });
say $quickadded_event->{id};

# Recurring events
say '=== Make recurring events via patch ===';
$service->events->patch(
    calendarId => $dest_calendar_id,
    eventId    => $quickadded_event->{id},
    body => {
        start => {
            timeZone => 'Asia/Tokyo',
        },
        end => {
            timeZone => 'Asia/Tokyo',
        },
        recurrence => [
            'RRULE:FREQ=WEEKLY;UNTIL=20120831T100000Z',
        ],
    }
)->execute({ auth_driver => $auth_driver });
say $quickadded_event->{updated};

Enjoy!

Tuesday, July 31, 2012

Updated to 0.06

I fixed the issue #5 which reported by uehatsu. (Thank you!) Then I updated version to 0.06.


And I added a few calendar API samples.


You can run like below.

$ git clone https://github.com/comewalk/google-api-perl-client.git
$ cd google-api-perl-client
$ perl -I lib eg/calendar/calendarlist.pl

Enjoy!

Monday, February 13, 2012

Updated to 0.05

Hi folks,

I was working hard in these months. How are you?

uechoco and gnustavo sent pull requests on github.
Then I applied them, and updated to 0.05.

uechoco, gnustavo, thank you for your contributions!

If you have any contributions, I welcome patches from you :)

Thanks!

Friday, December 2, 2011

Fwd: Checking Google APIs Discovery Service

I'm too late here. I'm a little busy in these days. In the near future, I'll build a Calendar API v3 sample. And I'll try to brush up this module as more useful.

I posted an entry on my blog. I just quoted that whole paragraph into this blog.


$ cp $services.txt $services_yesterday.txt
$ curl -s https://www.googleapis.com/discovery/v1/apis?fields=items/id | grep id > services.txt
$ cat services.txt
   "id": "adsense:v1"
   "id": "analytics:v2.4"
   "id": "analytics:v3"
   "id": "audit:v1"
   "id": "blogger:v2"
   "id": "books:v1"
   "id": "calendar:v3"
   "id": "customsearch:v1"
   "id": "discovery:v1"
   "id": "freebase:v1-sandbox"
   "id": "freebase:v1"
   "id": "groupssettings:v1"
   "id": "latitude:v1"
   "id": "moderator:v1"
   "id": "orkut:v2"
   "id": "pagespeedonline:v1"
   "id": "plus:v1"
   "id": "prediction:v1.2"
   "id": "prediction:v1.3"
   "id": "prediction:v1.4"
   "id": "shopping:v1"
   "id": "siteVerification:v1"
   "id": "taskqueue:v1beta1"
   "id": "tasks:v1"
   "id": "translate:v2"
   "id": "urlshortener:v1"
   "id": "webfonts:v1"
$ diff -bu $services_yesterday.txt $services.txt

I'm checking this everyday. I can find that Google add or remove APIs. You know how to use API Discovery resource like this :)


via blog.comewalk.com

Wednesday, October 26, 2011

Added AdSense Management API sample

I just added AdSense Management API sample in github


https://github.com/comewalk/google-api-perl-client/blob/master/eg/adsense

This sample is inspired by a thread in google-api-python-client group. Thanks!



So, you can try the sample like below.

 $ git clone git://github.com/comewalk/google-api-perl-client.git
 $ cd google-api-perl-client.git
 # Edit Client ID and Client Secret in client_secrets.json
 $ vim eg/adsense/client_secrets.json
 $ ls eg/adsense/*.pl | xargs -n 1 perl -I lib

Then you will see like this.

Ad client for product xxxx with ID aaa-bbb-1234567890 was found
  Supports reporting: true and 'Yes' or 'No'
Done
Wide character in print at eg/adsense/adunits_list.pl line 39.
Ad unit with code NNNNNNNNNN, name 300x250, 作成済み 10/06/07 and status INACTIVE was found
Done
Custom channel with code NNNNNNNNN and name http://www.s14u.info/mt/ was found
Done
== aaa-bbb-1234567890 ==
DATE PAGE_VIEWS AD_REQUESTS AD_REQUESTS_COVERAGE CLICKS AD_REQUESTS_CTR COST_PER_CLICK AD_REQUESTS_RPM EARNINGS
2011-01-24 1 1 1 0 0 N/A 0 0
2011-01-29 1 1 1 0 0 N/A 0 0
2011-03-31 2 2 1 0 0 N/A 0 0
2011-06-07 1 1 1 0 0 N/A 0 0
2011-06-09 1 1 1 0 0 N/A 0 0
2011-07-12 2 2 1 0 0 N/A 0 0
2011-08-04 18 18 1 0 0 N/A 0 0
2011-08-28 10 10 1 0 0 N/A 0 0
2011-08-29 11 11 1 0 0 N/A 0 0
2011-08-30 4 4 1 0 0 N/A 0 0
2011-09-08 1 1 1 0 0 N/A 0 0
2011-09-16 3 3 1 0 0 N/A 0 0
2011-09-26 2 2 1 0 0 N/A 0 0
Done
URL channel with URL pattern comewalk.example.com was found
Done

Also, I updated sample wiki page.


Enjoy!

Sunday, October 23, 2011

Support client_secrets.json file format

Joe Gregorio mentioned google-api-python-client has supported ClientSecrets at his Google+.


Then google-api-perl-client has supported the format.


Please see following sample.

https://github.com/comewalk/google-api-perl-client/blob/master/eg/plus/plus_with_clientsecrets.pl


my $client = Google::API::Client->new;
my $service = $client->build('plus', 'v1');

my $file = "$FindBin::Bin/client_secrets.json";
my $auth_driver = Google::API::OAuth2::Client->new_from_client_secrets($file, $service->{auth_doc});


See Also:

The file format is (loosely) defined here:
http://code.google.com/p/google-api-python-client/wiki/ClientSecrets
The oauth2client/google-api-python-client support is explained here:
http://code.google.com/p/google-api-python-client/wiki/ClientSecretsSupport

Thank you for your waiting for a while. I was a little bit busy in these days for YAPC::Asia Tokyo 2011, Google Developer Day 2011 Tokyo and so on.


Enjoy!

Tuesday, October 4, 2011

Search Is Available In Google+ API

Google announced that Google+ API has search method.


Okay, Google APIs Perl Client can call search API. I don't need to change any code. It's great point of Google APIs Discovery Service. Then I can use search method. So I created a command-line sample.

I created two types. The one is with OAuth2, other is with Simple API Access.


With OAuth2

You can see the script at github.

Try like below

$ git clone git://github.com/comewalk/google-api-perl-client.git
$ cd google-api-perl-client
$ vim eg/plus/search.pl

You need to edit and . Your CLIENT ID and CLIENT SECRET is at API Console.

Okay, let's run the script

$ perl -I lib eg/plus/search.pl
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/plus.me
Enter verification code: 

The script requires verification code. Please copy and paste the link from your console to your browser. Then your browser shows confirm page.

If you allow the access, you can get the code. Please paste the verification code to your console, then push return key.

You should see a result on your console like below.

$VAR1 = {
          'items' => [
                       {
                         'displayName' => 'Vic Gundotra'
                       },
                       {
                         'displayName' => 'Vic Ted'
                       },
                       {
                         'displayName' => 'Mark Lastiwka'
                       },
                       {
                         'displayName' => 'shreekrishna kc'
                       }
                     ]
        };

$VAR1 = {
          'items' => [
                       {
                         'object' => {
                                       'content' => 'Quirky and delicious recipes illustrated by artists from around the world? Yes, please!'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'I am finally putting together a holiday cookie e-book. It will have plenty of great ideas, recipes, and pictures. Hoping to have it available on both kindle and as an ebook next week.'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'I love this gorgeous fall weather! I'm gonna light my new gingerbread cookie candle and do some baking. I bought 3 pumpkins yesterday for some great fall recipes!'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'Yesterday's Vegan MoFo post - Three Applelicious recipes: Apple Fritters, Apple Crisp, and an Apple Pie Hummus: http://blog.prairievegan.com/2011/10/mofoer-monday-appleicious-recipes-from.html'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'Came home from work with crushing headache.  Slept for an hour and a half, and then made-- two (2) burgers for dinner, followed by lots (many) of Black Forest Chocolate Cookies.  Am feeling much better now.'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'Saw this all over the net and couldn't find the original post till now ...'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'These look delicious. I might even be able to make them!'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'An ultimate collection of cookies recipe now available on iPhone and iPad http://goo.gl/mi2YP'
                                     }
                       },
                       {
                         'object' => {
                                       'content' => 'REALLY?'
                                     }
                       }
                     ]
        };

With Simple API Access

Also I create a sample.

Try like below

$ git clone git://github.com/comewalk/google-api-perl-client.git
$ cd google-api-perl-client
$ vim eg/plus/search_simple.pl

You need to edit <YOUR SIMPLE API ACCESS KEY> instead your Simple API Access key. Your key is at API console, too.

$ perl -I lib eg/plus/search_simple.pl

You don't need to get verification code. Yeah, it's simple. You will see same results as with OAuth2.


Conclusion

I didn't need to change any code in Google APIs Perl Client. Google APIs Discovery Service is awesome. (Or my code is awesome ;p)

These samples are using fields parameter. First result is from people.search method with fields="items/displayName". You can see displayName only. Seconde result is from activity.search method with fields="items/object/content". Fields parameter allows us to get only what you want.

I showed you how to use search method in Google+ API as a command-line script. If you want PSGI application, please feel free let me know at comment.

Enjoy!

Wednesday, September 28, 2011

Google+ Perl Starter

Google+ has a page which listed some languages libraries.

Downloads

So, I created Google+ Perl Starter like other libraries.

http://code.google.com/p/google-plus-perl-starter/

The starter has two samples both PSGI application and command-line script.

If you're trying to implement your application written in Perl, please see the starter.

Enjoy!

Tuesday, September 27, 2011

Added Blogger API Sample

Updated Wed Sep 28 01:52:22 PDT 2011. Oops, I forgot a notice for everyone. You may need to request your quota for Blogger JSON API via Google APIs Console. Please check your console.


I added Blogger API sample on github. The sample shows blog object, post ids and URL for this blog.

https://github.com/comewalk/google-api-perl-client/blob/master/eg/blogger/cli_public_access.pl

You can try the sample like below.

 # Edit Simple API Access Key instead <YOUR API KEY>
 $ vim eg/blogger/cli_public_access.pl
 $ perl -I lib eg/blogger/cli_public_access.pl

Also, I updated sample wiki page.

Enjoy!

Monday, September 26, 2011

Added WebFonts API Sample

I added WebFonts API sample on github. The sample is listing available font families.

https://github.com/comewalk/google-api-perl-client/blob/master/eg/webfonts/cli_public_access.pl

You can try the sample like below.

 # Edit Simple API Access Key instead <YOUR API KEY>
 $ vim eg/webfonts/cli_public_access.pl
 $ perl -I lib eg/webfonts/cli_public_access.pl

Also, I updated sample wiki page.

Enjoy!

Added Analytics API Sample

I added Analytics API sample on github. The sample is calling management.accounts.list API.

https://github.com/comewalk/google-api-perl-client/blob/master/eg/analytics/cli_private_access.pl

You can try the sample like below.

 # Edit Client ID and Client Secret
 $ vim eg/analytics/cli_private_access.pl
 $ perl -I lib eg/analytics/cli_private_access.pl

Also, I updated sample wiki page.

Oops, I forgot to mention changes.

  • Implemented nested resource.
    For example, Analytics API Discovery Resource Document has nested resource section like below.
     "resources": {
      "management": {
       "resources": {
        "accounts": {
         "methods": {
          "list": {
    
    Then this module supported nested resource for now :)

Thanks!

Thursday, September 22, 2011

Just Released!

Hello Perl mongers,

I'm happy to say this. I just pushed Google API Perl Client to github right now.

https://github.com/comewalk/google-api-perl-client/

If you try this module, you can run like below.

 $ git clone git://github.com/comewalk/google-api-perl-client.git
 $ cd google-api-perl-client
 $ perl -I lib eg/urlshortener/cli_public_access.pl

Also, I put psgi app.

 $ plackup eg/urlshortener/sample.psgi

If you embed this module in your application, you may need both Client ID and Client secret for private access. You can get Client ID and Client secret at Google APIs Console. Please replace "<YOUR CLIENT ID>" and "<YOUR CLIENT SECRET>" to your ones.

Samples list is following page at Google Project Hosting. I'll add more API samples later.

http://code.google.com/p/google-api-perl-client/wiki/Samples

Also, this module is using Google Project Hosting. The URL is below.

http://code.google.com/p/google-api-perl-client/

I'll update this blog for announcements of Google API Perl Client. If you're interested in this module, please add this blog to your feed reader.

If you have any questions or suggestions, please feel free let me know at Google Groups google-api-perl-client.

Enjoy!