I want to upgrade my little tool from google contact api to google people api. The authorization is working and I get contacts from peopeService. But the person.Metadata source item array has only one item type "CONTACT". I do miss the 'updateTime' in person.Metadata.Sources. The code snipped:
PeopleResource.ConnectionsResource.ListRequest peopleRequest =
peopleService.People.Connections.List("people/me");
if (pageToken != null)
{
peopleRequest.PageToken = pageToken;
}
peopleRequest.RequestMaskIncludeField =
person.names,person.organizations,person.birthdays,person.biographies,
person.emailAddresses,person.Metadata,person.PhoneNumbers,person.Addresses,
person.userDefined";
ListConnectionsResponse people = peopleRequest.Execute();
if (people != null && people.Connections != null && people.Connections.Count > 0)
{
foreach (var person in people.Connections)
{
ConvertGooglePerson2ContactItem(person);
}
if (people.NextPageToken != null)
{
GetAllContactItems(people.NextPageToken);
}
}
Get Source data:
if (person.Metadata!=null)
foreach (var item in person.Metadata.Sources)
{
...
}
Maybe this is an issue with the query parameters Link. But I don't know how to set this query parameter.
-------- added on Jan 6 '21 as questions of comments --------
I have tried this API: https://developers.google.com/people/api/rest/v1/people.connections/list
With both fields set: personFields and requestMask.includeField:
400 Bad Request
{
"error": {
"code": 400,
"message": "Please specify only one of requestMask or personFields.",
"status": "INVALID_ARGUMENT"
}
}
The result of personFields only please see questions.
The metaData with personFields only of person was given:
"resourceName": "people/c623380167042605258",
"etag": "%Eg4BAj0FBwk+Cz8MEEA3LhoEAQIFByIMcG9JRnpDRzBxS0U9",
"metadata": {
"sources": [
{
"type": "CONTACT",
"id": "8a6b0f5889920ca",
"etag": "#poIFzCG0qKE=",
"updateTime": "2021-01-04T22:44:04.913Z"
}
],
"objectType": "PERSON"
},
Maybe it's an API problem?
How can I get last modified time of the people contact?
people.connections.list
method you can retrieve the updateTime by default. It is located in the JSON response atconnections/metadata/sources/updateTime
. – Rafa GuillermoupdateTime
is returned. – Rafa GuillermoCONTACT
for theperson.metadata.source
enum. You can see these here. – Rafa Guillermo