我无法从Google Contacts API获得照片。这是我使用的代码。
gapi.client.request({
method: 'GET',
path: '/m8/feeds/photos/media/default/1f27ce8913181e',
headers: {
"Content-Type":"image/*",
"GData-Version": "3.0",
"if-match":"*",
"data":token,
}
}).then(function(result){
console.log(result);
})
在内容类型中,我尝试了JSON和XML。还在上面的URL中添加了访问_token。所以请帮助我获得此图像。
预先感谢您。
请参阅检索联系人的照片:
要检索联系人的照片,请将授权的获取请求发送到联系人的照片链接URL。
URL的形式是:
https://www.google.com/m8/feeds/photos/media/{userEmail}/{contactId}
用适当的值代替用户邮件和ContactID。
Note: The special userEmail value default can be used to refer to the authenticated user.
The photo link can be retrieved from the contact entry returned by the API:
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:gContact="http://schemas.google.com/contact/2008"
xmlns:gd="http://schemas.google.com/g/2005"
gd:etag="{contactEtag}">
<id>
http://www.google.com/m8/feeds/contacts/{userEmail}/base/{contactId}
</id>
...
<title>Full Name</title>
<gd:name>
<gd:fullName>Full Name</gd:fullName>
</gd:name>
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*"
href="https://www.google.com/m8/feeds/photos/media/{userEmail}/{contactId}"
gd:etag="{photoEtag}"/>
<link rel="self" type="application/atom+xml"
href="https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}"/>
...
</entry>