13

I'm having a problem with the 2 APIs above. Given the next scenario: I have 2 different google accounts. One that doesn't use Google+ and a second account that uses Google+

When using Contacts API on the first account that doesn't use Google+ I can see all my contacts:

GET /m8/feeds/contacts/<email>/full

Same for the second account that uses Google+.

When I'm using People API for the first account that doesn't use Google+, I'm getting an empty response (actually I'm getting just the next sync token:

GET https://people.googleapis.com/v1/people/me/connections

With the next scope:

https://www.googleapis.com/auth/contacts

Returns:

{
  "nextSyncToken": "CMe6...."
}

The same call for the second account (with Google+) works like a charm

The only difference between the 2 accounts is Google+, is it possible that People API only works for accounts with Google+? Or is it something else that I'm missing

shachar
  • 641
  • 5
  • 12
  • What scopes have the accounts authorized access for? – abraham Apr 03 '16 at 22:10
  • Are you sure that your first account (non-Google+) has the same/similar connections as your second account (Google+)? Also, have you tried adding `scope` `https://www.googleapis.com/auth/contacts.readonly`? – AL. Apr 04 '16 at 03:37
  • I also tried the `https://www.googleapis.com/auth/contacts.readonly` scope, got the same results – shachar Apr 04 '16 at 03:45
  • @abraham I'm using `https://www.google.com/feeds` scope for the Contacts API and for the People API I tried `https://www.googleapis.com/auth/contacts` and `https://www.googleapis.com/auth/contacts.readonly` – shachar Apr 04 '16 at 04:03
  • seems Contacts API can't find in APIs Explorer now ,are you use the sample codes here ? :https://developers.google.com/google-apps/contacts/v3/ – dx3906 Aug 05 '16 at 04:06

2 Answers2

25

I found the difference between the 2 APIs and it has nothing to do with the fact that one of the accounts is connected to Google+ or not

People API will only fetch the contacts that are under the account "My contacts" contacts, while Contacts API will also fetch the other contacts lists ("Other contacts", "Most contacts", ...)

shachar
  • 641
  • 5
  • 12
  • 6
    I would like to fetch "Other contacts" with People API. Have you managed to find those? I only get "My contacts" – heffaklump Apr 26 '16 at 10:27
  • 3
    @heffaklump you can't fetch `Other Contacts` with people API. The only way is to use `Contacts API` – shachar May 03 '16 at 07:40
  • 2
    @sachar - Can you tell how to get "Other Contacts" group using Contacts API ?? I am not getting that listed when I list all the groups. – Sk. Irfan Mar 20 '18 at 11:47
3

The People API is the newer version.

From Google APIs related to People API page:

The Google Contacts API will be deprecated in the future. The People API is the recommended replacement for apps that read contact data.

It is also important to note that the People API does in fact allow the developer to use "other contacts" just like Contacts API did. In addition, when migrating you should not have to re-ask for user consent to the following:

Please see these links for further reading:

https://developers.google.com/people/related-apis (Contacts API vs People API) https://developers.google.com/people (Intro to People API)

I basically just copy/pasted most of this stuff but hopefully, some people find this helpful as I too was curious to find these answers :)

Josh Lear
  • 99
  • 1
  • 2
  • "the People API does in fact allow the developer to use 'other contacts' just like Contacts API did" This is still completely false. The People API does not allow creating or editing Other Contacts. – KLiFF Oct 26 '20 at 07:43
  • it isn't the exact same as myContacts but it does let you access and manipulate otherContacts via PeopleAPI try for yourself: 1. got to https://developers.google.com/people/api/rest/v1/otherContacts/list 2. set required fields 3. go to people.get, input resourceName and change from otherContacts/... to people/... (also, don't forget etag in your new person object) 4. enter required fields then run 5. go to people.get, use the resourceName and the altered field to lookup the contact. 6. voila, otherContact has been updated... although they are now in "myContacts" not "otherContacts" – Josh Lear Oct 28 '20 at 19:20
  • @JoshLear isn't ""https://www.googleapis.com/auth/contacts.other.readonly" scope considered to be a special sensitive scope that requires a security check that costs $20,000? – Nathan B May 29 '21 at 12:03