Reputation: 4038
I am trying to get the user location using google api
https://developers.google.com/people/api/rest/v1/people/get
The above link tells me to give resourcename of person but I dont know how to get the resourcename of a person, and how to get it?
Upvotes: 3
Views: 2009
Reputation: 5253
I exhort you to read the whole documentation since the answer is there. As you can see here, the resourceName
value is:
The resource name for the person, assigned by the server. An ASCII string with a max length of 27 characters, in the form of people/person_id.
Therefore, in order to get the resourceName
of people, you need to get a list of the people you have connections with by using the method described here. That method will return a response that looks like this:
{
"connections": [
{
"resourceName": "people/c4975894400662151399",
"etag": "%EgYBAgMGGCvT1UyNGZxV0hZPQ==",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "424762b0ee1ef",
"etag": "#724fqWHY=",
"updateTime": "2017-07-29T13:00:33.607002Z"
}
],
"objectType": "PERSON"
},
"names": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "424762b0ee1ef"
}
},
"displayName": "User One",
"familyName": "One",
"givenName": "User",
"displayNameLastFirst": "One, User"
}
],
"photos": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "424762bc0d0ee1ef"
}
},
"url": "https://lh3.googleusercontent.com/-XdUIqdMWA/AAAAAAAAI/AAAAAAAAA/4252r5MyReBVCg-JHqUZby0PuQkKAVcQ____________RieL7______8B/s0/photo.jpg"
}
],
"urls": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "424762b0ee1ef"
}
},
"value": "http://www.google.com/profiles/114002589440066215139",
"type": "profile",
"formattedType": "Profile"
}
]
}
],
"nextPageToken": "^CAAQk5r4hNorGncKTQAQwA0ICEAFIhrWIy7a31QJQAlokZTc0YWU0OGYtYWQ4ZC00MThlLWI3MjAtYjE4MTczYzRhNGFkEAIaJGU3NGFlNDhmLWFkOGQtNDE4ZS1iNzIwLWIxODE3M2M0YTRhZA",
"totalPeople": 94,
"totalItems": 94
}
The above only shows the result for one people resource since I limited the paging results to 1, but hopefully it will give you an idea. After you get the resourceName
, you should be able to use the method https://developers.google.com/people/api/rest/v1/people/get.
Upvotes: 2