getSearchRecords Method
Table of Contents
Purpose
You can use this method to search records by expressions of the selected columns.
Request URL
XML Format:
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
JSON Format:
https://crm.zoho.com/crm/private/json/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
Note:
- Irrespective of Zoho CRM Edition, you can send only 250 API requests / day. In each call you can fetch a maximum of 200 records.
Request Parameters
Parameter | Data Type | Description |
authtoken* | String | Encrypted alphanumeric string to authenticate your Zoho credentials. |
scope* | String | Specify crmapi as the scope |
selectColumns* | String | Module(optional columns) i.e, Leads(Last Name,Website,Email) OR All |
searchCondition* | String | (Created By|=|username) |
newFormat | Integer | newFormat=1: To exclude fields with "null" values while inserting data from your CRM account. newFormat=2: To include fields with "null" values while inserting data from your CRM account. |
fromIndex | Integer | Default value - 1 |
toIndex | Integer | Default value - 20 Maximum value - 200 |
version | Integer | version = 1: (Default value) This will fetch responses based on the earlier API implementation i.e prior to the enhancements made. version = 2: This will fetch responses based on the latest API implementation. |
* - Mandatory parameter
Note:
- Refer the Release Notes page to learn more about enhancements made in the API implementation.
Regular Expressions
While using this method, ensure selectColumns and searchCondition parameters are set as mandatory. You can specify the following expressions in API request:
- is OR =
- isn't OR <>
- contains(*srcString*)
- starts with(srcString*)
- ends with(*srcString)
- doesn't contain
- < OR is before
- > OR is after
- <=
- =>
Examples
Example 1
If you want to select Lead Name,Company,Email,Mobile,Website from Leads and Email should contain "@sample.com",Search API request should be as given below:
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Lead Name,Company,Email,Mobile,Website)&searchCondition=(Email|contains|*@sample.com*)
Example 2
If you want to select Company,Email,Website from Leads and No of Employees should be greater than 100, Search API request should be as given below:
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Company,Email,Website)&searchCondition=(No of Employees|>|100)
Example 3
If you want to select Lead Name,Email from Leads and Company should start with "Zoho", then the search API request should be as given below:
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Lead Name,Email)&searchCondition=(Company|starts with|Zoho*)
Example with equal(=)
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)&searchCondition=(Email|=|test@test.com)
Example with greater than(>)
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)
&searchCondition=(Annual Revenue|>|1000)
Example with less than(<)
Note:
- Replace null value Integer fields with "0". Integer fields with no value will not be included in the search.
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)
&searchCondition=(customfield1|<|1000)
Example with contains
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)
&searchCondition=(Company|contains|*oho*)
Example with starts with
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)
&searchCondition=(Company|starts with|zoho*)
Example with ends with
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=Leads(First Name,Last Name,Email,Company)
&searchCondition=(Company|ends with|*zoho)
Example with equal(=) and selectColumns=All
https://crm.zoho.com/crm/private/xml/Leads/getSearchRecords?authtoken=Auth Token&scope=crmapi
&selectColumns=All
&searchCondition=(Email|=|test@test.com)
Test Program
You can use the attached program to run and test the working of the getSearchRecords method in your Java Environment.
The Java Program contains the following:
- the authtoken generation format
- the parameters and their values
- actual usage of the method
Click here to download the program