Option to get the contact entries updated after a specific time NOT given in Google People API
Asked Answered
S

1

6

We use Google Contacts API to get contact entries that are updated after a specific time to keep an updated copy of the contacts on our end.

In Google Contacts API, there is an option to get the contact entries updated after a specific time using "updated-min" query parameter.

GET https://www.google.com/m8/feeds/contacts/default/full?updated-min=2007-03-16T00:00:00

There is no option specified in Google People API for such a case in Google People documentation. Am I missing anything or is this feature not given?

Sheng answered 4/5, 2021 at 15:3 Comment(3)
I'm not seeing any documentation about it. Seems like the query parameters page was already updated and earliest it was crawled by archive sites was september 2020, (already like what it is now). I'd like to assume, (unless it was confirmed by other users by testing and making it work) this feature is still not implemented.Pharmacist
Although, an alternative seems to be available as seen on the migration guide and you can make use of update_time. Since Contacts is deprecated and scheduled for sunset on June 15, 2021, It's better if you try and make it work using update_time by fetching all contact entries and then filtering them by their update_time. This may be the closest thing you might have to work on.Pharmacist
A better way is to filter them by getting the last updated time of the person (contact) which is given in the sources param of Person object. But it seems like unnecessary work. To get the 10 or so contacts which have been last updated, having to fetch all the contacts (which has a max limit of 25,000).Sheng
C
3

If you're trying to implement an incremental sync where you want all the contacts that were changed (or created/deleted) since the last sync time, then instead of using a time object you can use syncToken.

It works like this - you first call people.connections.list without a syncToken, and with requestSyncToken true. The last response page will include a field syncToken which you can send in future people.connections.list calls to get only the resources changed since the last request.

See this: https://developers.google.com/people/api/rest/v1/people.connections/list#query-parameters

Celie answered 5/5, 2021 at 10:13 Comment(2)
Yes, just tried this today morning. It works! The only flaw is, we have to keep the sync running every 7 days (at the most) as the syncToken expires after 7 days. So if we are giving custom sync time to customer, it should be within 7 days.Sheng
i think that's by design, so every so often you'll be forced to do a full-sync to make sure no change slipped through the cracks...Celie

© 2022 - 2024 — McMap. All rights reserved.