google-contacts-api - 这些是联系人 API 搜索方法的 People API 中的一个很好的替代品吗?
问题描述
现在我们正在尝试用 People API 替换 Contact API,这看起来很复杂。首先,没有办法在所有联系人中搜索(联系人、其他联系人、域联系人)。所以我们需要在三个不同的地方搜索并合并结果。或者我错过了什么?之前我们使用service.getFeed(query, ContactFeed.class);
第二个问题是 Contact API 中的搜索与 People API 中的搜索方式不同。联系人 API 将所有包含所提供查询的联系人作为字段中的子字符串返回。People API 仅返回包含以提供的查询开头的字段的联系人。
有没有人找到解决这些问题的方法?
UPDATE1: 在 People API 中,我们需要在三个不同的地方进行搜索:
https://developers.google.com/people/api/rest/v1/otherContacts/search - 在其他联系人列表中搜索; https://developers.google.com/people/api/rest/v1/people/searchContacts - 在联系人列表中搜索; https://developers.google.com/people/api/rest/v1/people/searchDirectoryPeople - 在用户的域目录中搜索;
这是一篇描述差异的文章: https ://www.nylas.com/blog/google-people-api-vs-contacts-api-migration Section "Parse Contact Info"
UPDATE2:这是联系人 API,Java 的代码:
Query query = new Query(new URL("https://www.google.com/m8/feeds/contacts/default/full"));
query.setMaxResults(Integer.MAX_VALUE);
query.setFullTextQuery("du"); // query itself
contactsService.getFeed(query, ContactFeed.class).getEntries();
解决方案
使用 People API,您必须调用 3 个端点,而不是像使用 Contacts API 时那样调用 1 个端点。
推荐阅读
- omnet++ - 找不到错误 ueAppIdToMeAppMapKey 条目
- ruby-on-rails - 如何在 ruby 的哈希中制作 deep_slice
- unity3d - 如何在移动设备的 x 或 y 轴上检测手指拖动?
- angular - Angular 11:错误 TS2339:“对象”类型上不存在属性“数据”,但一切正常
- java - 有没有办法通过安卓应用程序创建键盘宏?
- c# - 如何隐藏/更改起始页中的 URL?
- android - Android 自动填充服务在 Chrome 中不起作用
- charts - 如何在pinescript中最低点之后的下一个最高点
- python - 如何制作简单的地图编辑器或关卡编辑器?
- amazon-web-services - 使用 AWS cli 将自定义域迁移到不同的 API 终端节点时出现问题