getRecords Method

 Purpose

You can use the getRecords method to fetch all users data specified in the API request.

 Request URL

XML Format:
https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?

JSON Format:
https://<APPDOMAIN>/crm/private/json/Leads/getRecords?

 Auth Token

Auth Token is an encrypted alphanumeric string that is required to authenticate your CRM account credentials. A valid user's Authentication Token is necessary to access the API. When making an API request, send the authentication token in the Authorization header as shown below:

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?

Header:

Authorization=1000XXXX65.1000XXXX44.caXXXXXXXXXXXX

(See Using Authentication Token )

 Request Parameters

ParameterData TypeDescription
selectColumnsStringModule(optional columns) i.e, leads(Last Name,Website,Email) OR All
fromIndexIntegerDefault value - 1
toIndexIntegerDefault value - 20
Maximum value - 200
sortColumnStringStringIf you use the sortColumnString parameter, by default data is sorted in ascending order.
sortOrderStringStringDefault value - asc
if you want to sort in descending order, then you have to pass sortOrderString=desc.
lastModifiedTimeDateTimeDefault value: null
If you specify the time, modified data will be fetched after the configured time.
newFormatIntegernewFormat=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.
versionIntegerversion = 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.

 Capture Errors

CRM Platform API provides unique error codes to easily troubleshoot issues in your program while synchronizing data between CRM and your application. To learn more about various error codes and corresponding defintion please refer the Error Codes .

 Additional Notes

  • While retrieving data from your CRM platform, user’s field-level security settings are applied. Hence to fetch all users data, use the user ID with highest role (Ex: CEO) and profile (Ex: Administrator).
  • 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 all accounts in JSON format sorted by Account Name (in descending order) starting from 20 to 200

URL Format:

https://<APPDOMAIN>/crm/private/json/Accounts/getRecords?newFormat=1&fromIndex=20&toIndex=200&sortColumnString=Account Name&sortOrderString=desc

 To fetch all accounts in XML format modified / created after 2008-05-27 00:00:00

URL Format:

https://<APPDOMAIN>/crm/private/xml/Accounts/getRecords?newFormat=1&lastModifiedTime=2008-05-27 00:00:00

 To Fetch Leads with version = 1

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?selectColumns=Leads(First Name,Last Name,Email,Company,Campaign Source)&version=1

It will return a response like below:

<Leads>
<row no="1">
<FL val="LEADID">2000000022020</FL>
<FL val="Company">Zillium</FL>
<FL val="First Name">Scott</FL>
<FL val="Last Name">James</FL>
<FL val="Email">scott@zillum.com</FL>
<FL val="CAMPAIGNID">2000000072001</FL>
<FL val="Campaign Source">Webinar</FL>
</row>
</Leads>

 To Fetch Leads with version = 2

It will return a response like below:

<Leads>
<row no="1">
<FL val="LEADID">2000000022020</FL>
<FL val="Company">Zillium</FL>
<FL val="First Name">Scott</FL>
<FL val="Last Name">James</FL>
<FL val="Email">scott@zillum.com</FL>
</row>
</Leads>

 To Fetch Leads without specifying the newFormat parameter

Note:

  • When there is no specification about the response format, the default value "1" is assigned to the newFormat parameter, i.e newFormat = 1

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company,No of Employees,Annual Revenue,Created By,Created Time)

It 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 with newFormat=2

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?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>

 To Call with fromIndex=1,toIndex=25

https:/<APPDOMAIN>/crm/private/xml/Leads/getRecords?newFormat=1
&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company)
&fromIndex=1&toIndex=25

Note:

  • This will return 1 to 25 records.

 To Call with lastModifiedTime

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?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

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?newFormat=1&selectColumns=All

Note:

  • This will return all fields which have values.

 To select all fields from leads with newFormat=2

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?newFormat=2&selectColumns=All

Note:

  • This will return all fields, including null value fields.

 To Call with lastModifiedTime, fromIndex and toIndex

https://<APPDOMAIN>/crm/private/xml/Leads/getRecords?newFormat=1
&selectColumns=Leads(Lead Owner,First Name,Last Name,Email,Company)
&lastModifiedTime=2010-04-21 11:09:23
&fromIndex=1
&toIndex=25

 To Call with lastModifiedTime, fromIndex and toIndex (for the Accounts Module)

https://<APPDOMAIN>/crm/private/xml/Accounts/getRecords?newFormat=1
&selectColumns=Accounts(Account Owner,Account Name,Phone,Industry)
&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 getRecords method in your Java Environment.
The Java Program contains the following:

  • the ticket generation format
  • the parameters and their values
  • actual usage of the method

Click here  to download the program