我目前正在实施Contact Applicationusing Google Contact APIin Java。我已完成授权步骤并获得访问令牌和刷新令牌。
现在我有了CLIENT_ID , CLIENT_SECRET AND REFRESH_TOKEN。但是访问令牌将在一个小时内过期。
有人可以告诉如何在 Java 中使用刷新令牌自动生成访问令牌吗?
我正在尝试从Android联系人列表中检索联系人的姓名,电话号码和地址.名称和电话非常简单,但1.6 api级别的地址似乎无法访问.
有人想出如何获得联系人的地址吗?2.0中还有一个全新的api.如何通过使用1二进制来利用这个并回退到旧的api.如果这是可能的.
我正在使用gdata-python-client库(http://code.google.com/p/gdata-python-client/)将联系人插入Google帐户.当我设置这样的性别时:
google_contact.gender = gdata.contacts.data.Gender(text="Male")
Run Code Online (Sandbox Code Playgroud)
它实际上是在"目录服务器"字段中的联系人上设置的.
任何想法为什么会这样?
如果它影响任何事情,我的代码将在Google App Engine开发服务器上运行.
我正在使用Google通讯录API提取用户的联系人电子邮件地址和姓名.有没有办法获得这些人的Google+ ID?
我使用以下代码通过 Google .Net 客户端库向 Google 进行身份验证。
public static void auth()
{
string clientId = "xxxxxx.apps.googleusercontent.com";
string clientSecret = "xxxxx";
string[] scopes = new string[] { "https://www.googleapis.com/auth/contacts.readonly" }; // view your basic profile info.
try
{
// Use the current Google .net client library to get the Oauth2 stuff.
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
, scopes
, "test"
, CancellationToken.None
, new FileDataStore("test")).Result;
// Translate the Oauth permissions to something the old client …Run Code Online (Sandbox Code Playgroud) 我正在使用此 API来获取用户的联系人。我会得到与联系人关联的标签,但在文档中找不到它。我不是在谈论标签属性,比如<gContact:relation label="drinking buddy">Marvin</gContact:relation>但这种标签:
如果有人能告诉我在哪里可以找到这个标签。
如何检索属于某个组的所有联系人?我不希望所有联系人的完整列表只是来自特定组的联系人.
这是小组:DEBUG 2009-07-28 12:01:32,681 helloworld.py:21]群组是ID为http://www.google.com/ m8/feeds/groups/XXXX%40gmail.com/base的客户/ XXXX
这是代码:
def fetch_feed(self):
client = gdata.contacts.service.ContactsService()
client.ClientLogin(username, password) #Will change to AuthSub later.
query = gdata.contacts.service.ContactsQuery()
query.max_results = 3000
feed = client.GetContactsFeed(query.ToUri())
memcache.set('feed',feed, 3600)
return feed
feed = self.fetch_feed()
self.PrintFeed(feed)
def PrintFeed(self, feed):
for entry in feed.entry:
print entry.* #example... i can access properties such as entry.title, entry.id, entry.updated, but can't access a whole lot more.
Run Code Online (Sandbox Code Playgroud)
我做错了什么,或者我根本不做什么?我在Apps API论坛上发布了相同的问题,只是为了澄清事情.
编辑 这是我正在导入的内容:
from google.appengine.api import memcache, users
from google.appengine.ext import db, webapp
from google.appengine.ext.webapp import util
import atom
import atom.url
import datetime …Run Code Online (Sandbox Code Playgroud) 我发现当我获取所有联系人的Feed时,Google Contacts API v3不会返回系统组:
https://www.google.com/m8/feeds/contacts/default/full
Run Code Online (Sandbox Code Playgroud)
但是如果我通过GET param提供v2:
https://www.google.com/m8/feeds/contacts/default/full?v=2
Run Code Online (Sandbox Code Playgroud)
为联系人条目返回所有系统组.
当我尝试获取组列表时,同样的事情:
https://www.google.com/m8/feeds/groups/default/full
Run Code Online (Sandbox Code Playgroud)
是否有其他方式来接收系统组?或者v3只是不支持接收系统组了?
google-contacts-api google-apps-marketplace google-shared-contacts
我正在尝试访问contacts.readonly范围,同时在Google Developers Console中的项目API中启用了Contacts API.
$ export client_id='**********************************************.apps.googleusercontent.com'
$ export scope='https://www.googleapis.com/auth/contacts.readonly'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/contacts.readonly]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
Run Code Online (Sandbox Code Playgroud)
当我将范围更改为读写时,这有效:
$ export scope='https://www.google.com/m8/feeds'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"device_code" : "*********************************************",
"user_code" : "********",
"verification_url" : "https://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
Run Code Online (Sandbox Code Playgroud)
在控制台中添加Google+ API也无济于事.
我想知道如何让所有联系人都与一个群组相关.假设我有一个名为"My Special Group"的联系人组,ID为xxxxxxx.我只想检索"My Special Group"下的联系人.
我已经尝试过这个Request URI并在oauth2 playground上测试它:
https://www.google.com/m8/feeds/contacts/default/full/?group=xxxxxxx.https://www.google.com/m8/feeds/contacts/myemail%40gmail.com/full/?group=xxxxxxx.结果是:
<errors xmlns="http://schemas.google.com/g/2005">
<error>
<domain>GData</domain>
<code>invalid</code>
<internalReason>Supposed groupUri xxxxxxxxdoes not match template</internalReason>
</error>
</errors>
Run Code Online (Sandbox Code Playgroud)
检索与特定组相关的联系人的正确Request URI究竟是什么?
已经走过stackoverflow并且答案正是我上面做的.它失败了.
我已使用 Google Contact API 检索了我的所有联系人。现在,我想使用此People API GET链接中提到的 get 请求获取所有这些联系人的 Google 个人资料信息。但我在响应中没有看到任何发出请求的 ID。
google-api ×4
gdata-api ×3
google-plus ×2
python ×2
access-token ×1
addressbook ×1
android ×1
asp.net ×1
c# ×1
google-oauth ×1
iis ×1
java ×1