1
votes

Now we are trying to replace Contact API with People API and it seems very complicated. First of all, there is no method to search in all contacts (Contact, Other contact, Domain contacts). So we need to search in three different places and merge results. Or I am missing something? Previously we used service.getFeed(query, ContactFeed.class);

The second problem is that search in Contact API works in a different way than in People API. Contact API returns all contacts that contain a provided query as a substring in fields. People API returns contacts only that contain a field that start with provided query.

Does anyone find a solution to these problems?

UPDATE1: In People API we need to search in three different places:

https://developers.google.com/people/api/rest/v1/otherContacts/search - to search among Other contacts list; https://developers.google.com/people/api/rest/v1/people/searchContacts - to search among Contact list; https://developers.google.com/people/api/rest/v1/people/searchDirectoryPeople - to search among user's Domain directory;

Here is an article describing differences: https://www.nylas.com/blog/google-people-api-vs-contacts-api-migration Section "Parse Contact Info"

UPDATE2: Here is the code for Contacts 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();
1
What are the 3 queries you are making in the People API?Aerials
@Aerials, these three: developers.google.com/people/api/rest/v1/otherContacts/search - to search among Other contacts list; developers.google.com/people/api/rest/v1/people/searchContacts - to search among Contact list; developers.google.com/people/api/rest/v1/people/… - to search among user's Domain directory; Here is an article describing differences: nylas.com/blog/google-people-api-vs-contacts-api-migration Section "Parse Contact Info"Dmitriy
Thanks for the update. Can you post the call you were making to Contacts API that you want to replicate with the People API?Aerials
Here it is: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 return contactsService.getFeed(query, ContactFeed.class).getEntries();Dmitriy

1 Answers

0
votes

Using the People API you do have to call the 3 endpoints instead of 1 as you did with the Contacts API.