Google People API - the new version of Google Contacts Api
How can I create a new contact using Google People API and at the same time "register" or add that contact to multiple user groups/labels. Previously using the google contact api this was trivial but Google has now updated their API and depreciated their OLD API.
I have an example below of what I am trying to achieve. For example I wish to create a new contact "Steve Jobs" that belongs to the groups/labels in google contacts "Apple" and "Technology" and "Super_User".
I am using this endpoint - https://developers.google.com/people/api/rest/v1/people/createContact
Also you should note that it works fine with 1 group but not with multiple groups.
Thank you in advance!
"memberships": [
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789010",
"contactGroupResourceName": "contactGroups/1234567890"
}
}
]
}
}
],
"names": [
{
"familyName": "Jobs",
"givenName": "Steve"
}
]
}```
I managed to solve this myself. I'm a silly person. Obviously you need to ensure that the contact group id equals an existing ID that is in your Google Contacts account. You can see the ID by creating a group in google contacts then clicking on the group name. Look in your URL and it will show the contact group ID.
"memberships": [
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789"
}
},
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/123456789832"
}
},
{
"contactGroupMembership": {
"contactGroupResourceName": "contactGroups/232353433233"
}
}
]