Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to do "path variable" substitution for API calls? #7

Open
sdondley opened this issue Aug 4, 2018 · 1 comment
Open

Possible to do "path variable" substitution for API calls? #7

sdondley opened this issue Aug 4, 2018 · 1 comment

Comments

@sdondley
Copy link

sdondley commented Aug 4, 2018

I'm trying to figure out how to make the API call found at https://developers.google.com/people/api/rest/v1/people/get and I'm having trouble.

Google returns the following path using the Discovery API: https://people.googleapis.com/v1/{+resourceName}

I would like to replace {+resourceName} with people/me. The documentation doesn't appear to address this possibility. Can it be done?

@sdondley
Copy link
Author

sdondley commented Aug 4, 2018

Solved with a lower level method, api_query():

#! /usr/bin/env perl
use Moo::Google;
use Data::Dumper qw (Dumper);

my $gapi = Moo::Google->new(debug => 0);
my $user = 'me@gmail.com';

$gapi->auth_storage->setup({ type => 'jsonfile', path => 'config.json' });
$gapi->user($user);
$gapi->do_autorefresh;

$res = $gapi->api_query( {
    httpMethod => 'get',
    path => 'https://people.googleapis.com/v1/people/me',
    options => { personFields => 'emailAddresses' }
});

print Dumper $res;

If there is a better way, I'd be interested in hearing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant