getMyRecords Method
Table of Contents
- Purpose
- Request URL
- Request Parameters
- Error Codes
- Examples
- To fetch leads data from Zoho CRM
- To fetch more than 200 records
- To fetch leads with “Company” name in the ascending order
- To fetch leads with "Company" name in the descending order
- To fetch leads without specifying the newFormat parameter
- To fetch leads with "newFormat=2"
- To fetch first 25 leads from Zoho CRM
- To fetch leads with "lastModifiedTime" parameter
- To select all fields from leads with newFormat=1 parameter
- To select all fields from leads with newFormat=2
- To fetch leads with lastModifiedTime, fromIndex and toIndex parameters
- Test Program
Purpose
You can use the getMyRecords method to fetch data by the owner of the Authentication tokenspecified in the API request.
Request URL
XML Format:
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi
JSON Format:
https://crm.zoho.com/crm/private/json/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi
Request Parameters
| Parameter | Data Type | Description |
| authtoken* | String | Encrypted alphanumeric string to authenticate your Zoho credentials. |
| scope* | String | Specify the value as crmapi |
| selectColumns | String | To select the required fields from CRM module. Format: Module(optional columns) Example: leads(Last Name,Website,Email) OR All |
| fromIndex | Integer | Default value - 1 |
| toIndex | Integer | Default value - 20 Maximum range value - 200 [Maximum range value = toIndex - fromIndex] |
| sortColumnString | String | You can select one of the fields in CRM in to sort the data. Ex: sortColumnString=Company Here, sorting of the data will happen based on the Company field |
| sortOrderString | String | Sorting order: asc or desc If you use the sortColumnString parameter, by default data is sorted in ascending order. |
| lastModifiedTime | yyyy-MM-dd HH:mm:ss | Default value: null If you specify the time, created/modified data will be fetched after the configured time. |
| newFormat | Integer (1 or 2) | newFormat=1: To exclude fields with "null" values while fetching data from your CRM account. newFormat=2: To include fields with "null" values while fetching data from your CRM account. |
| version | Integer | version = 1:(Default value) This will fetch responses based on the earlier API implementation i.e prior to the enhancements made. Current version is 4. |
* - Mandatory parameter
Note:
- Refer the Release Notes page to learn more about enhancements made in the API implementation.
Error Codes
Please refer Error Codes.
Additional Notes
- While retrieving data from your Zoho CRM account, role-based security (Roles, Profiles, Field-level security and Data sharing rules) is applied. For role-based security settings, see Security Administration.
- fromIndex and toIndex are optional parameters. By default the fromIndex is 1 and toIndex is 20.
- sortColumnString and sortOrderString are also optional parameters
- The value for lastModifiedTime parameter should be in yyyy-MM-dd HH:mm:ss format
Examples
To fetch leads data from Zoho CRM
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?newFormat=1&authtoken=Auth Token&scope=crmapi
To fetch data from other modules, replace Leads with Accounts, Contacts, Potentials, etc.
To fetch more than 200 records
By default you can fetch 20 records per batch. However, by using the toIndex parameter you can fetch up to 200 Records per batch. If you want to fetch more than 200 records, follow the steps given below:
Iteration 1: fromIndex=1&toIndex=200
Iteration 2: fromIndex=201&toIndex=400
To fetch leads with “Company” name in the ascending order
sortColumnString=Company&sortOrderString=asc
To fetch leads with "Company" name in the descending order
sortColumnString=Company&sortOrderString=desc
To fetch leads without specifying the newFormat parameter
Note:
- When there is no specification about the response format, the default value "1" will be assigned to the newFormat parameter, i.e newFormat = 1
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company,No of Employees,Annual Revenue,Created By,Created Time)
This will return a response like below:
<Leads>
<row no="1">
<FL val="LEADID">2000000022020</FL>
<FL val="SMOWNERID">2000000018005</FL>
<FL val="Lead Owner">John</FL>
<FL val="Company">Zillium</FL>
<FL val="First Name">Scott</FL>
<FL val="Last Name">James</FL>
<FL val="No of Employees">10</FL>
<FL val="Annual Revenue">1000.0</FL>
<FL val="SMCREATORID">2000000016908</FL>
<FL val="Created By">John</FL>
<FL val="Created Time">2010-03-16 10:04:52</FL>
<FL val="Modified Time">2010-03-16 10:04:52</FL>
</row>
</Leads>
To fetch leads with "newFormat=2"
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=2&selectColumns=Leads(Lead Owner,First Name,Last Name,Company,Designation,Email,Phone,Fax,Mobile,Website,Lead Source,Lead Status,No of Employees,Annual Revenue)
This will return a response like below:
<Leads>
<row no="1">
<FL val="LEADID">2000000022020</FL>
<FL val="SMOWNERID">2000000018005</FL>
<FL val="Lead Owner">John</FL>
<FL val="Company">Zillium</FL>
<FL val="First Name">Scott</FL>
<FL val="Last Name">James</FL>
<FL val="Designation">null</FL>
<FL val="Email">null</FL>
<FL val="Phone">null</FL>
<FL val="Fax">null</FL>
<FL val="Mobile">null</FL>
<FL val="Website">null</FL>
<FL val="Lead Source">null</FL>
<FL val="Lead Status">null</FL>
<FL val="No of Employees">0</FL>
<FL val="Annual Revenue">0.0</FL>
</row>
</Leads>
To fetch first 25 leads from Zoho CRM
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company)&fromIndex=1&toIndex=25
To fetch leads with "lastModifiedTime" parameter
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company)&lastModifiedTime=2010-04-21 11:09:23
Note:
- If you specify the time, modified data will be fetched after the configured time.
To select all fields from leads with newFormat=1 parameter
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=All
Note:
- This will return all fields which have values.
To select all fields from leads with newFormat=2
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=2&selectColumns=All
Note:
- This will return all fields, including null value fields.
To fetch leads with lastModifiedTime, fromIndex and toIndex parameters
https://crm.zoho.com/crm/private/xml/Leads/getMyRecords?authtoken=Auth Token&scope=crmapi&newFormat=1&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company)&lastModifiedTime=2010-04-21 11:09:23 &fromIndex=1&toIndex=25
Test Program
You can use the attached program to run and test the working of the getMyRecords method in your Java Environment.
The Java Program contains the following:
- the authentication token generation format
- the parameters and their values
- actual usage of the method