Search Service

The SearchService allows you to retrieve the results of saved searches and reports that have been saved within Infusionsoft. Saved searches/reports are tied to the User that created them. This service also allows you to utilize the quick search function found in the upper right hand corner of your Infusionsoft application.

Note** that in order to retrieve the Id number for saved searches you will need to utilize the DataService.query method and query the table called SavedFilter based on the UserId you are looking for the saved search Id for. Also note that UserId field on the SavedFilter table can contain multiple userId's separated by a comma, so if you are querying for a report created by userId 6, I recommend appending the wildcard to the end of the userId. Something like $query = array( 'UserId' => '6%' );


SearchService.getAllReportColumns

Gets all possible fields/columns available for return on a saved search/report

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
savedSearchId int The Id of the saved search you would like columns for
userId int The Id number of the user who created the saved search

Returns

(struct) An array of fields available for returns when using the SearchService.getSavedSearchResults method

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>SearchService.getAllReportColumns</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>savedSearchId</int></value>
    </param>
    <param>
      <value><int>userId</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>Id</name>
            <value>Id</value>
          </member>
          <member>
            <name>FilterId</name>
            <value>Filter Id</value>
          </member>
          <member>
            <name>ContactId</name>
            <value>Contact Id</value>
          </member>
          <member>
            <name>ContactName</name>
            <value>Name</value>
          </member>
          <member>
            <name>ContactName.firstName</name>
            <value>First Name</value>
          </member>
          <member>
            <name>ContactName.lastName</name>
            <value>Last Name</value>
          </member>
          <member>
            <name>SpouseName</name>
            <value>Spouse Name</value>
          </member>
          <member>
            <name>Birthday</name>
            <value>Birthday</value>
          </member>
          <member>
            <name>BirthdayMonth</name>
            <value>Birthday Month</value>
          </member>
          <member>
            <name>BirthdayYear</name>
            <value>Birthday Year</value>
          </member>
          <member>
            <name>CompanyInfo</name>
            <value>Company</value>
          </member>
          <member>
            <name>Company</name>
            <value>Company Name</value>
          </member>
          <member>
            <name>CompanyID</name>
            <value>Company Id</value>
          </member>
          <member>
            <name>PhoneWithExtension1</name>
            <value>Phone 1</value>
          </member>
          <member>
            <name>PhoneNumber</name>
            <value>Phone 1</value>
          </member>
          <member>
            <name>Phone1Ext</name>
            <value>Phone 1 Ext</value>
          </member>
          <member>
            <name>Phone1Type</name>
            <value>Phone 1 Type</value>
          </member>
          <member>
            <name>PhoneWithExtension2</name>
            <value>Phone 2</value>
          </member>
          <member>
            <name>PhoneNumber2</name>
            <value>Phone 2</value>
          </member>
          <member>
            <name>Phone2Ext</name>
            <value>Phone 2 Ext</value>
          </member>
          <member>
            <name>Phone2Type</name>
            <value>Phone 2 Type</value>
          </member>
          <member>
            <name>PhoneWithExtension3</name>
            <value>Phone 3</value>
          </member>
          <member>
            <name>PhoneNumber3</name>
            <value>Phone 3</value>
          </member>
          <member>
            <name>Phone3Ext</name>
            <value>Phone 3 Ext</value>
          </member>
          <member>
            <name>Phone3Type</name>
            <value>Phone 3 Type</value>
          </member>
          <member>
            <name>Email</name>
            <value>Email</value>
          </member>
          <member>
            <name>EmailAddress2</name>
            <value>Email Address 2</value>
          </member>
          <member>
            <name>EmailAddress3</name>
            <value>Email Address 3</value>
          </member>
          <member>
            <name>FaxWithType1</name>
            <value>Fax 1</value>
          </member>
          <member>
            <name>FaxNumber</name>
            <value>Fax 1</value>
          </member>
          <member>
            <name>Fax1Type</name>
            <value>Fax 1 Type</value>
          </member>
          <member>
            <name>FaxWithType2</name>
            <value>Fax 2</value>
          </member>
          <member>
            <name>FaxNumber2</name>
            <value>Fax 2</value>
          </member>
          <member>
            <name>Fax2Type</name>
            <value>Fax 2 Type</value>
          </member>
          <member>
            <name>StreetAddress1</name>
            <value>Street Address 1</value>
          </member>
          <member>
            <name>StreetAddress2</name>
            <value>Street Address 2</value>
          </member>
          <member>
            <name>City</name>
            <value>City</value>
          </member>
          <member>
            <name>State</name>
            <value>State</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour1</name>
            <value>Postal Code</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour1.postalCode</name>
            <value>Postal Code</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour1.zipFour</name>
            <value>Zip Four</value>
          </member>
          <member>
            <name>Country</name>
            <value>Country</value>
          </member>
          <member>
            <name>Address2Street1</name>
            <value>Street Address 1 (Shipping)</value>
          </member>
          <member>
            <name>Address2Street2</name>
            <value>Street Address 2 (Shipping)</value>
          </member>
          <member>
            <name>City2</name>
            <value>City (Shipping)</value>
          </member>
          <member>
            <name>State2</name>
            <value>State (Shipping)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour2</name>
            <value>Postal Code (Shipping)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour2.postalCode</name>
            <value>Postal Code (Shipping)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour2.zipFour</name>
            <value>Zip Four (Shipping)</value>
          </member>
          <member>
            <name>Country2</name>
            <value>Country (Shipping)</value>
          </member>
          <member>
            <name>Address3Street1</name>
            <value>Street Address 1 (Optional)</value>
          </member>
          <member>
            <name>Address3Street2</name>
            <value>Street Address 2 (Optional)</value>
          </member>
          <member>
            <name>City3</name>
            <value>City (Optional)</value>
          </member>
          <member>
            <name>State3</name>
            <value>State (Optional)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour3</name>
            <value>Postal Code (Optional)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour3.postalCode</name>
            <value>Postal Code (Optional)</value>
          </member>
          <member>
            <name>PostalCodePlusZipFour3.zipFour</name>
            <value>Zip Four (Optional)</value>
          </member>
          <member>
            <name>Country3</name>
            <value>Country (Optional)</value>
          </member>
          <member>
            <name>PhoneWithExtension4</name>
            <value>Phone 4</value>
          </member>
          <member>
            <name>PhoneNumber4</name>
            <value>Phone 4</value>
          </member>
          <member>
            <name>Phone4Ext</name>
            <value>Phone 4 Ext</value>
          </member>
          <member>
            <name>Phone4Type</name>
            <value>Phone 4 Type</value>
          </member>
          <member>
            <name>PhoneWithExtension5</name>
            <value>Phone 5</value>
          </member>
          <member>
            <name>PhoneNumber5</name>
            <value>Phone 5</value>
          </member>
          <member>
            <name>Phone5Ext</name>
            <value>Phone 5 Ext</value>
          </member>
          <member>
            <name>Phone5Type</name>
            <value>Phone 5 Type</value>
          </member>
          <member>
            <name>Products</name>
            <value>Products</value>
          </member>
          <member>
            <name>Tags</name>
            <value>Tag Ids</value>
          </member>
          <member>
            <name>ContactType</name>
            <value>Person Type</value>
          </member>
          <member>
            <name>JobTitle</name>
            <value>Job Title</value>
          </member>
          <member>
            <name>Website</name>
            <value>Website</value>
          </member>
          <member>
            <name>SSN</name>
            <value>SSN</value>
          </member>
          <member>
            <name>LastSSN</name>
            <value>Last SSN</value>
          </member>
          <member>
            <name>MiddleName</name>
            <value>Middle Name</value>
          </member>
          <member>
            <name>Nickname</name>
            <value>Nickname</value>
          </member>
          <member>
            <name>Username</name>
            <value>Username</value>
          </member>
          <member>
            <name>Password</name>
            <value>Password</value>
          </member>
          <member>
            <name>AssistantName</name>
            <value>Assistant Name</value>
          </member>
          <member>
            <name>AssistantPhone</name>
            <value>Assistant Phone
            .</value>
          </member>
          <member>
            <name>Title</name>
            <value>Title</value>
          </member>
          <member>
            <name>Suffix</name>
            <value>Suffix</value>
          </member>
          <member>
            <name>Anniversary</name>
            <value>Anniversary</value>
          </member>
          <member>
            <name>AnniversaryMonth</name>
            <value>Anniversary Month</value>
          </member>
          <member>
            <name>AnniversaryYear</name>
            <value>Anniversary Year</value>
          </member>
          <member>
            <name>CreatedBy</name>
            <value>Created By</value>
          </member>
          <member>
            <name>DateCreated</name>
            <value>Date Created</value>
          </member>
          <member>
            <name>LastUpdated</name>
            <value>Last Updated</value>
          </member>
          <member>
            <name>OwnerID</name>
            <value>OwnerID</value>
          </member>
          <member>
            <name>Owner</name>
            <value>Owner</value>
          </member>
          <member>
            <name>ContactNotes</name>
            <value>Notes</value>
          </member>
          <member>
            <name>LeadSourceIdOverride</name>
            <value>Leadsource</value>
          </member>
          <member>
            <name>ReferralCode</name>
            <value>Referral Code</value>
          </member>
          <member>
            <name>CompanyIdFilter</name>
            <value>Company Id Filter</value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$savedSearchId = 3;
$userId = 1;
$results = $app->getAvailableFields($savedSearchId, $userId);

Runs a saved search/report and returns all possible fields

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
savedSearchId int The Id number of the saved search being run
userId int The userId who the saved search is assigned to. If it is 'Everyone', you still need to pass a valid userId
pageNumber int The page you would like results from. Zero is the first page

Returns

(struct) results of the given saved search

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>SearchService.getSavedSearchResultsAllFields</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>savedSearchId</int></value>
    </param>
    <param>
      <value><int>userId</int></value>
    </param>
    <param>
      <value><int>pageNumber</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>Id</name>
                  <value><i4>12</i4></value>
                </member>
                <member>
                  <name>ContactName</name>
                  <value>Andrew Watson</value>
                </member>
                <member>
                  <name>Company</name>
                  <value>Widgets inc</value>
                </member>
                <member>
                  <name>PhoneWithExtension1</name>
                  <value>
                  </value>
                </member>
                <member>
                  <name>Email</name>
                  <value/>
                </member>
                <member>
                  <name>State</name>
                  <value/>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>Id</name>
                  <value><i4>16</i4></value>
                </member>
                <member>
                  <name>ContactName</name>
                  <value>John Doe</value>
                </member>
                <member>
                  <name>Company</name>
                  <value/>
                </member>
                <member>
                  <name>PhoneWithExtension1</name>
                  <value>
                  </value>
                </member>
                <member>
                  <name>Email</name>
                  <value>there_he_go@itsjohndoe.com</value>
                </member>
                <member>
                  <name>State</name>
                  <value/>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>Id</name>
                  <value><i4>22</i4></value>
                </member>
                <member>
                  <name>ContactName</name>
                  <value>Derp Doe</value>
                </member>
                <member>
                  <name>Company</name>
                  <value/>
                </member>
                <member>
                  <name>PhoneWithExtension1</name>
                  <value>
                  </value>
                </member>
                <member>
                  <name>Email</name>
                  <value>JDoe@email.com</value>
                </member>
                <member>
                  <name>State</name>
                  <value/>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>Id</name>
                  <value><i4>24</i4></value>
                </member>
                <member>
                  <name>ContactName</name>
                  <value>John Doe</value>
                </member>
                <member>
                  <name>Company</name>
                  <value/>
                </member>
                <member>
                  <name>PhoneWithExtension1</name>
                  <value>
                  </value>
                </member>
                <member>
                  <name>Email</name>
                  <value>JDoe@email.com</value>
                </member>
                <member>
                  <name>State</name>
                  <value/>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>Id</name>
                  <value><i4>26</i4></value>
                </member>
                <member>
                  <name>ContactName</name>
                  <value>John Doe</value>
                </member>
                <member>
                  <name>Company</name>
                  <value/>
                </member>
                <member>
                  <name>PhoneWithExtension1</name>
                  <value>
                  </value>
                </member>
                <member>
                  <name>Email</name>
                  <value>JDoe@email.com</value>
                </member>
                <member>
                  <name>State</name>
                  <value/>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$savedSearchId = 5;
$userId = 34;
$results = $app->savedSearchAllFields($savedSearchId, $userId, 0);

SearchService.getSavedSearchResults

Runs a saved search/report returning only the specified fields

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
savedSearchId int The Id number of the saved search being run
userId int The userId who the saved search is assigned to. If it is 'Everyone', you still need to pass a valid userId
pageNumber int The page you would like results from. Zero is the first page
returnFields array The fields/columns of data you want returned from this saved search

Returns

(struct) the specified fields for the given saved search/report

Sample Request

<?xml version="1.0"?>
<methodCall>
	<methodName>SearchService.getSavedSearchResults</methodName>
	<params>
		<param>
			<value><string>privateKey</string></value>
		</param>
		<param>
			<value><int>savedSearchId</int></value>
		</param>
		<param>
			<value><int>userId</int></value>
		</param>
		<param>
			<value><int>pageNumber</int></value>
		</param>
		<param>
			<value><array>
			<data>
				<value><string>ContactId</string></value>
			</data>
			</array></value>
		</param>
	</params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      12
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      22
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      38
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      16
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      26
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      40
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      28
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      30
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      36
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>
                    ContactId
                  </name>
                  <value>
                    <i4>
                      32
                    </i4>
                  </value>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$rets = array('ContactId','FullName');
$results = $app->savedSearch(326,6,0,$rets);

This is used to find what possible quick searches the given user has access to

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
userId int The userId you are checking access for

Returns

(struct) The quick search types available for the given user

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>SearchService.getAvailableQuickSearches</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>14</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>FindPerson</name>
            <value>Person</value>
          </member>
          <member>
            <name>FindCompany</name>
            <value>Company</value>
          </member>
          <member>
            <name>FindTask</name>
            <value>Task/Appt/Note</value>
          </member>
          <member>
            <name>FindOrder</name>
            <value>Order</value>
          </member>
          <member>
            <name>FindSubscription</name>
            <value>Subscription</value>
          </member>
          <member>
            <name>FindOpportunity</name>
            <value>Opportunity</value>
          </member>
          <member>
            <name>FindAffiliate</name>
            <value>Affiliate</value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$userId = 6;
$result = $app->getQuickSearches($userId);

SearchService.quickSearch

This allows you to run a quick search via the API. The quick search is the search bar in the upper right hand corner of the Infusionsoft application

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
quickSearchType int The type of search you are running. Person, Order, Opportunity, Company, Task, Subscription, or Affiliate
userId int The Id number of the user running this search. Results are dependent on this users' permissions
searchData int String to run the search based on
page int The page of results you would like returned
returnLimit int Number of results returned. Max is 1000

Returns

(struct) An array of all results returned from this quick search

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>SearchService.quickSearch</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><string>quickSearchType</string></value>
    </param>
    <param>
      <value><int>userId</int></value>
    </param>
    <param>
      <value><string>searchData</string></value>
    </param>
    <param>
      <value><int>page</int></value>
    </param>
    <param>
      <value><int>limit</int></value>
    </param>
  </params>
</methodCall>
					

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><array><data/></array></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$userId = 1;
$searchData = 'in';
$results = $app->quickSearch('FindPerson', $userId, $searchData, 0, 1000);

SearchService.getDefaultQuickSearch

Retrieves the quick search type that the given users has set as their default

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
userId int The id of the user to lookup their search defaults

Returns

(string) The quick search type that the given user has selected as their default

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>SearchService.getDefaultQuickSearch</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>userId</int></value>
    </param>
  </params>
</methodCall>
					

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>null</value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$userId = 1;
$results= $app->getDefaultQuickSearch($userId);