QUERY CONTACTS

Lists existing contacts

This operation queries for existing contacts using optional filters such as ContactListId, Field, ContactListId and more. It returns a list of contacts and all associated information. See GetContact if you need to to return just a single contact by id.

REQUEST PARAMETERS

Parameter Data Type Demo Value Description
QueryContacts object Contacts request by query which can include String, Field, and ContactListId
MaxResults long 1000 Max number of results to return limited to 1000 (default: 1000)
FirstResult long 0 Start of next result set (default: 0)
Field string Field to filter by
ContactListId long ContactList to filter by
String string Substring contained in Contact to filter by

RESPONSE PARAMETERS

Parameter Data Type Description
ContactQueryResult List of Contacts returned from query
TotalResults long Results count
Contact Info about the people you want to contact. Any info needed can be stored under Contact as an extra attribute.
lastName string Last name
externalId string id of contact defined by external system (NATION_BUILDER, GOOGLE_GROUPS, etc...)
mobilePhone PhoneNumber E.164 11 digit number
firstName string First name
externalSystem string System where externalId was generated from (NATION_BUILDER, GOOGLE_GROUPS, etc...)
homePhone PhoneNumber E.164 11 digit number
workPhone PhoneNumber E.164 11 digit number
zipcode string 5 digit zipcode
Id long Unique ID of Contact

EXAMPLE

In this example, we will search contacts from contact list "1" with "Contact2" as part of the last name. We are also limiting the search up to 100 matches starting from the 21st match.

using RestSharp;

namespace [your-namespace]
{
    public class [your-class]
    {
        public string QueryContacts()
        {
            var client = new RestClient("https://www.callfire.com/api/1.1/rest/");
            client.Authenticator = new HttpBasicAuthenticator("YourLoginId", "password");

            var request = new RestRequest("contact", Method.GET);
            request.AddParameter("MaxResults", "100");
            request.AddParameter("FirstResult", "21");
            request.AddParameter("ContactListId", "1");
            request.AddParameter("Field", "lastName");
            request.AddParameter("String", "Contact2");

            var response = client.Execute(request);
            string content = response.Content;
            return content;
        }
    }
}

RESPONSE PARAMETERS

Matches

Response Code: 200

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceList xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource" totalResults="132">

<Contact homePhone="14252163710" lastName="Contact2_LastName" firstName="Contact2_Name" id="165332795001"/>

<Contact homePhone="14252163710" lastName="Contact2_LastName" firstName="Contact2_Name" id="167003395001"/>

<Contact homePhone="14252163710" lastName="Contact2_LastName" firstName="Contact2_Name" id="167003968001"/>

<Contact homePhone="14252163710" lastName="Contact2_LastName" firstName="Contact2_Name" id="167003981001"/>

<Contact homePhone="14252163710" lastName="Contact2_LastName" firstName="Contact2_Name" id="167005631001"/>

</r:ResourceList>

RESPONSE PARAMETERS

No Matches

Response Code: 200

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceList xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource" totalResults="0"/>

RESPONSE PARAMETERS

Invalid Parameter

Response Code: 400

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<r:ResourceException xmlns="http://api.callfire.com/data" xmlns:r="http://api.callfire.com/resource">

    <r:HttpStatus>400</r:HttpStatus>

    <r:Message>value 'NaN' is not valid for parameter 'maxResults'</r:Message>

</r:ResourceException>

This error can be caused due to sending an invalid value for the parameter type, such as sending an alphanumeric string instead of an integer in the field 'maxResults'.