Markus
Markus

Reputation: 598

Can't get ageRanges with Google API

I can't seem to get the ageRanges property via the People API.

works:

https://people.googleapis.com/v1/people/me?personFields=emailAddresses

does NOT work:

https://people.googleapis.com/v1/people/me?personFields=ageRanges
https://people.googleapis.com/v1/people/me?personFields=ageRange
https://people.googleapis.com/v1/people/me?personFields=age_ranges
https://people.googleapis.com/v1/people/me?personFields=age_range

Has anyone else this problem?

Upvotes: 0

Views: 205

Answers (2)

Markus
Markus

Reputation: 598

Turns out Google API works as expected. Posting the answer here in case anyone else runs into the same issue. I forgot to set the YEAR for my age in my Google+ account when I created it many years ago. Of course there is a 404 for age range then. Worked flawlessly after I set the year. 😅

Upvotes: 1

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116908

I think you should try testing using the API exploer the request you have posted works fine.

Request

GET https://people.googleapis.com/v1/people/me?personFields=ageRanges&access_toke={your token}

response

{
 "resourceName": "people/11720047553267277534",
 "etag": "%EgQBNDcuGg0BAgMEBQYHCAkKCwwNIgxwMnBTbXRpYWF2RT0=",
 "ageRanges": [
  {
   "metadata": {
    "primary": true,
    "source": {
     "type": "ACCOUNT",
     "id": "11720047553267277534"
    }
   },
   "ageRange": "TWENTY_ONE_OR_OLDER"
  }
 ]
}

Upvotes: 0

Related Questions