4

I need to import google contacts to my application. For that I try to use the Google People API but I didn't find an option to get the contacts custom fields.

Is it possible to get contact custom fields with the new Google People API? Should I use the old Google Contacts API for that?

Thanks!

1 Answers1

1

Request the userDefined projection with your personFields.

String url = "https://people.googleapis.com/v1/people/me/connections" + "?personFields=names,emailAddresses,userDefined";

The response looks like this:

"userDefined": [
        {
          "metadata": {
            "primary": true,
            "source": {
              "type": "CONTACT",
              "id": "5629e24b082d1a66"
            }
          },
          "key": "label1",
          "value": "foo"
        },
        {
          "metadata": {
            "source": {
              "type": "CONTACT",
              "id": "5629e24b082d1a66"
            }
          },
          "key": "label2",
          "value": "bar"
        }
      ]

For more details, see https://developers.google.com/people/api/rest/v1/people#Person.UserDefined

You can also update custom fields even though the documentation does not currently list userDefined as a valid field for updatePersonFields as the field mask.

https://developers.google.com/people/api/rest/v1/people/updateContact

Steven Spungin
  • 27,002
  • 5
  • 88
  • 78