The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

VUser::Google::ApiProtocol::V2_0 - Implements version 2.0 of the Google APIs.

SYSNOPSIS

use VUser::Google::ApiProtocol::V2_0;

## Create a new connection
my $google = VUser::Google::ApiProtocol::V2_0->new(
    domain   => 'your.google-apps-domain.com',
    admin    => 'admin_user',
    password => 'admin_user password',
);

## Login to the Google Apps API
# Login() uses the credentials provided in new()
$google->Login();

## Create a new request
# Create the URL to send to API request to.
# See the API docs for the valid URLs
my $url = "https://apps-apis.google.com/a/feeds/emailsettings/2.0/"
$url   .= "your.google-apps-domain.com/username/label";

# Create XML message to send to Google
# See the API docs for the valid XML to send
my $xml = '<?xml version="1.0" encoding="utf-8"?>...';

# NB: The method (POST here) may be different depending on API call
my $success = $google->Request('POST', $url, $xml);

# Get the parsed response
if ($success) {
    # $result is the XML reply parsed by XML::Simple
    my $result = $google->get_result;
}
else {
    # $result is the error message from google
    # parsed by XML::Simple with the addition of a
    # 'reason' key which contains the error.
    my $result = $google->get_result;
    die "Error: $result->{reason}";
}

DESCRIPTION

Implements version 2.0 of the Google API. See VUser::Google::ApiProtocol for a list of members and methods.

SEE ALSO

VUser::Google::ApiProtocol, XML::Simple

AUTHOR

Randy Smith <perlstalker@vuser.org>

Adapted from code from Johan Reinalda <johan@reinalda.net>

LICENSE

Copyright (C) 2006 by Johan Reinalda, johan at reinalda dot net Copyright (C) 2009 by Randy Smith, perlstalker at vuser dot org

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.

If you make useful modification, kindly consider emailing then to me for inclusion in a future version of this module.