2017-08-01 65 views

回答

0

我叮囑你閱讀整個文檔,因爲答案就在那裏。正如你可以看到hereresourceName的值是:

由服務器分配的人的資源名稱。最長爲27個字符的ASCII字符串,格式爲people/person_id。

因此,爲了得到人們的resourceName,您需要使用方法,讓你有聯繫的人的清單描述here。該方法將返回看起來像這樣的迴應:

{ 


"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 
} 

以上僅顯示一個人的結果,因爲資源限制我的傳呼結果爲1,但希望它會給你一個想法。在獲得resourceName後,您應該可以使用方法https://developers.google.com/people/api/rest/v1/people/get

+0

兄弟感謝您的回答,其實我正在實施谷歌登錄,我想獲得用戶的位置,而不是他的連接...請幫助我兄弟 –

+0

@vSugumar這是不是已經在這裏回答https://stackoverflow.com/questions/45409632/how-to-get-user-location-information-using-google-client-api? – Morfinismo

相關問題