What is the equivalent method in People API for ContactsApp.getContactsByCustomField?

195 Views Asked by At

In my old App Script, I use the following syntax:

var contacts = ContactsApp.getContactsByCustomField('tennis', 'Favorite Sport')

See documentation here.

I am now moving to People API. I can't seem to find the documentation for searching people using UserDefined values.

What I have found so far is search by name, not by user defined fields.

This does not search on my user defined fields:

var response = People.People.searchContacts({
  query: "tennis",
  readMask: "names,userDefined"
})
1

There are 1 best solutions below

0
Wicket On

I'm afraid that there is no equivalent in the Advanced People Service for ContactsApp.getContactsByCustomField


From https://developers.google.com/people/api/rest/v1/people/searchContacts

The query matches on a contact's names, nickNames, emailAddresses, phoneNumbers, and organizations fields that are from the CONTACT source.

Regarding "readMask", it is used to specified the fields to be included in the response.


Related