CallFire Solutions

Query Contacts

Follow

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

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

RESPONSE PARAMETERS

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

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'.

Have more questions? Submit a request

Comments