I have the resourceName and etag of the person I wish to update, but I can't understand the documentation to actually execute the update.
I've looked at the API Documentation, and I feel like I'm structuring everything correctly. However, I keep getting Error 400 responses of two types:
1)
https://people.googleapis.com/v1/people/c1596007341306697743:updateContact?updatePersonFields=%7B%27emailAddresses%27%3A+%5B%7B%27value%27%3A+%27hello%40gmail.com%27%7D%5D%7D&alt=json returned "Invalid value at 'update_person_fields' (type.googleapis.com/google.protobuf.FieldMask), Field 'update_person_fields', Invalid FieldMask '{'emailAddresses': [{'value': '[email protected]'}]}'. Map keys should be represented as ["some_key"].">
2)
https://people.googleapis.com/v1/people/c1596007341306697743:updateContact?updatePersonFields=%7B%27emailAddresses%27%3A+%7B%27value%27%3A+%27hello%40gmail.com%27%7D%7D&alt=json returned "Invalid updatePersonFields mask path: "{'email_addresses': {'value': '[email protected]'}}". Valid paths are documented at https://developers.google.com/people/api/rest/v1/people/updateContact.">
The first happens when the list brackets ([ ]) are left in the updatePersonFields parameter, the second when they are taken away.
I'm doing my best to implement this entirely in Python, and succeeded with both looking at and creating contacts. It seems that the update call is somehow different than the others. Any and all input is welcomed and appreciated.
profileCode = "people/blahblahblah"
accessToken = "%Eblahblahblah="
update = API.people().updateContact(
resourceName=profileCode,
body={"resourceName":profileCode, "etag":accessToken},
updatePersonFields={"emailAddresses":[{"value":"[email protected]"}]}
).execute()