I'm attempting to make a request for the profile information of a user logged in via Google OAuth. My request is formed properly, I log in successfully, but when I attempt to make the following request in PHP, I get the error Request Mask cannot be empty. Valid paths are: ...
However, it is clear from the Google People API people.get documentation that the request mask values are optional, and if not passed, will return all values except for people.connections.list. Here is my code:
// The entire OAuth process works up until this point...
// create the service
$service = new Google_Service_People($this->client);
try {
$results = $service->people->get('people/me');
} catch(\Exception $exception) {
echo $exception->getMessage();
exit;
}
Here are is the exception message I get from this error:
{ "error": { "code": 400, "message": "Request mask can not be empty. Valid paths are: [person.addresses, person.age_ranges, person.biographies, person.birthdays, person.bragging_rights, person.cover_photos, person.email_addresses, person.events, person.genders, person.im_clients, person.interests, person.locales, person.memberships, person.metadata, person.names, person.nicknames, person.occupations, person.organizations, person.phone_numbers, person.photos, person.relations, person.relationship_interests, person.relationship_statuses, person.residences, person.skills, person.taglines, person.urls].", "errors": [ { "message": "Request mask can not be empty. Valid paths are: [person.addresses, person.age_ranges, person.biographies, person.birthdays, person.bragging_rights, person.cover_photos, person.email_addresses, person.events, person.genders, person.im_clients, person.interests, person.locales, person.memberships, person.metadata, person.names, person.nicknames, person.occupations, person.organizations, person.phone_numbers, person.photos, person.relations, person.relationship_interests, person.relationship_statuses, person.residences, person.skills, person.taglines, person.urls].", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } }
Can anyone help me out?
Update 1:
When I try to pass in some value for the request mask, $service->people->get('people/me', array("person.names"));
I get the exception message: Illegal string offset 'type'
"google/apiclient": "^2.0"
. I deleted thevendor
folder and completely reinstalled dependencies withcomposer install
, but was still hitting the same issue. I'm not sure if something changed or not, but it seems like something changed in their internal API logic. – Arlon