这些是 People API for Contact API 搜索方法的一个很好的替代品吗?

问题描述

现在我们正在尝试用 People API 替换 Contact API,这看起来很复杂。 首先,没有办法搜索所有联系人(联系人、其他联系人、域联系人)。所以我们需要在三个不同的地方进行搜索并合并结果。或者我错过了什么?以前我们使用 service.getFeed(query,ContactFeed.class);

第二个问题是 Contact API 中的搜索与 People API 中的搜索方式不同。 Contact API 返回包含提供的查询作为字段中的子字符串的所有联系人。 People API 仅返回包含以提供的查询开头的字段的联系人。

有没有人找到解决这些问题的方法

更新 1: 在 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 部分“解析联系信息”

更新2: 以下是 Java 联系人 API 的代码

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 个端点。