Can I search for a contact by Phone with the REST API?

(Neil) #1

I am trying to search for a contact by their Phone number and then add a Tag. I understand the process to be:

  1. Search
  2. Save ID
  3. Update Contact by ID

This is a text messaging system, so the safest thing I can search on is by Phone - is that possible?

UPDATE: Looking at https://developer.infusionsoft.com/docs/rest/#!/Contact/listContactsUsingGET I see that I can only search using Email, Given_name and Family_name. Could this be right? I just can’t imagine why I couldn’t use phone number?

(Tom Scott) #2

Unfortunately, since there are multiple phone number fields on a Contact record, we don’t currently support search by phone number via the API.

However, it is possible to perform this search yourself by searching multiple times via the Legacy XML-RPC API, once for each Phone field:

https://developer.infusionsoft.com/docs/xml-rpc/#data-find-a-record-by-matching-a-specific-field
https://developer.infusionsoft.com/docs/table-schema/

2 Likes
(Pav) #3

One thing to add in regards to Phone Numbers, is that the Infusionsoft Interface adds the US Formatting to the number. In other words you may get brackets with the number.

You would need to use the XML-RPC Query function on the Contact table.
The search query will need to contain wildcards to compensate for any non-numeric characters.

So for example, if you had the number (123) 555-1234, then the search will need to be “%1%2%3%5%5%5%1%2%3%4”. In other words you would need to prefix each number with a % symbol, which means search anything in-between.

1 Like