I can't update Google Contact with Tomcat's web application

17 views Asked by At

Good day.

I've created a Tomcat's web application that manage Google Contact through my Google app. I haven't problem creating or deleting contact, but when i try to update it an exception occur.

Using

service.people().updateContact("people/c3001613119211561864", person).execute();

when service is a PeopleService class and person is a com.google.api.services.people.v1.model.Person class that I set in several its fields this is the result:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
POST https://people.googleapis.com/v1/people/c3001613119211561864:updateContact
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "updatePersonFields mask is required. Please specify one or more valid paths. Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.",
"reason": "badRequest"
}
],
"message": "updatePersonFields mask is required. Please specify one or more valid paths. Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.",
"status": "INVALID_ARGUMENT"
}

If I try to use

service.people().updateContact("people/c3001613119211561864", person).setPersonFields("person.names,person.emailAddresses,person.addresses,person.phoneNumbers,person.urls,person.occupations,person.userDefined,person.etag").execute();

this is the error that appear

com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
POST https://people.googleapis.com/v1/people/c3001613119211561864:updateContact?personFields=person.names...
{
"code": 400,
"errors": [
{
"domain": "global",
"message": "updatePersonFields mask is required. Please specify one or more valid paths. Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.",
"reason": "badRequest"
}
],
"message": "updatePersonFields mask is required. Please specify one or more valid paths. Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.",
"status": "INVALID_ARGUMENT"
}

How can I fix the problem?

Best regards.

Stefano Errani

0

There are 0 answers