Get Records API
A record is an entity which stores all the combined information of a particular contact or company, which is acquired from various sources. The information may be acquired from a web-form, social media services, advertisements etc. The records API allows the user to get, create, update or delete.
Purpose
To get the list of available records from a module.
Request Details
Request URL
https://www.zohoapis.com/bigin/v1/{module_api_name}
module_api_name - The API name of the module.
Scope
scope=ZohoBigin.modules.ALL
(or)
scope=scope=ZohoBigin.modules.{module_name}.{operation_type}
Possible module names
Accounts (companies in Bigin), contacts, deals, tasks, events, calls, products, and activities
Possible operation types
ALL - Full access to the record
READ - Get records from the module
Parameters
- fieldsstring, optional
To list all the module records with respect to fields.
Multiple field API names, comma separated. For example: Last_Name,Email - sort_orderstring, optional
To sort the list of records in either ascending or descending order.
Possible values:asc - ascending order; desc - descending order - sort_bystring, optional
Specify the API name of the field based on which the records must be sorted.
Possible values: Field API names. Example: Email - approvedstring, optional
To retrieve the list of approved records. Default value is true.
Possible values:true - get only approved records; false - get only records which are not approved; both - get all records - pageinteger, optional
To get the list of records from the respective pages. Default value for page is 1.
Possible values: Positive Integer values only. - per_pageinteger, optional
To get the list of records available per page. Default value for page is 200.
Possible values: Positive Integer values only. - cvidstring, optional
To get the list of records in a custom view.
Possible values: {custom_view_id} which you can get using custom view metadata API.
The sort_order parameter applies to given sort_by parameter value.
If sort_by field is not provided, then it applies to the system-defined field.
The page and per_page parameter is used to fetch records according to their position in the Bigin. Let's assume that the user has to fetch 400 records. The maximum number of records that one can get for an API call is 200. So, for records above the 200th position, they cannot be fetched. By using the page (1 and 2) and per_page (200) parameter, the user can fetch all 400 records using 2 API calls.
Refer Response Structure for more details about the JSON keys, values, and their descriptions.
Sample Request
Copiedcurl "https://www.zohoapis.com/bigin/v1/Accounts"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
CopiedZCRMModule module = ZCRMModule.getInstance("Products");
BulkAPIResponse response = module.getRecords(425476547854l, "Company",
CommonUtil.SortOrder.asc, 1, 4);// get Records with cvID, sortField,
sortOrder, startIndex and endIndex.
List<ZCRMRecord> records = (List<ZCRMRecord>)response.getData();
Copied$zcrmModuleIns = ZCRMModule::getInstance("Contacts");
$bulkAPIResponse=$zcrmModuleIns->getRecords();
$recordsArray = $bulkAPIResponse->getData(); // $recordsArray - array of ZCRMRecord instances
Copieddef get_records(self):
try:
module_ins = ZCRMModule.get_instance('Invoices') # module API Name
resp = module_ins.get_records()
print(resp.status_code)
record_ins_arr = resp.data
for record_ins in record_ins_arr:
print(record_ins.entity_id)
print(record_ins.owner.id)
print(record_ins.created_by.id)
print(record_ins.modified_by.id)
print(record_ins.created_time)
print(record_ins.modified_time)
product_data = record_ins.field_data
for key in product_data:
print(key + ":" + str(product_data[key]))
print("\n\n")
except ZCRMException as ex:
print(ex.status_code)
print(ex.error_message)
print(ex.error_code)
print(ex.error_details)
print(ex.error_content)
CopiedSyntax:
zoho.crm.getRecords(<module String>,<page Long>,<perPage Long>,<optionalDataMap Map>,<connectionName String>,<userAccess Boolean>);
mandatory : module
Sample Request:
resp = zoho.crm.getRecords("Leads",5,2,{"converted":"false"});
CopiedZCRMModule moduleIns = ZCRMModule.GetInstance("Leads"); //module api name
List<string> fields = new List<string> {"Last_Name","Company", "Email","id" }; //field api name
BulkAPIResponse<ZCRMRecord> response = moduleIns.GetRecords(3372164000000087503, "Company",CommonUtil.SortOrder.asc, 1, 4, fields);// get Records with cvId, sortByField, sortOrder, startIndex, endIndex and fieldApiNamelist.
List<ZCRMRecord> records = response.BulkData; //records - list of ZCRMRecord instance
Possible Errors
- INVALID_MODULEHTTP 400
The module name given seems to be invalid
Resolution: You have specified an invalid module name or there is no tab permission, or the module could have been removed from the available modules. Specify a valid module API name. - INVALID_MODULEHTTP 400
The given module is not supported in API
Resolution: The modules such as Documents and Projects are not supported in the current API. (This error will not be shown, once these modules are been supported). Specify a valid module API name. - NOT_SUPPORTEDHTTP 403
This API is supported only for admin users
Resolution: Only admin users can fetch records from the Notes module.
Sample Response
Copied{
"data": [
{
"Owner": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Description": null,
"$currency_symbol": "$",
"Shipping_State": null,
"Website": null,
"$followers": null,
"Last_Activity_Time": "2020-10-23T14:17:30+00:00",
"Industry": null,
"Modified_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Phone": null,
"Billing_Country": null,
"Account_Name": "Watson's Professional Services",
"id": "529793000000437091",
"Modified_Time": "2020-10-20T19:13:17+00:00",
"Billing_Street": null,
"Created_Time": "2020-10-20T19:13:17+00:00",
"$followed": false,
"$editable": true,
"Billing_Code": null,
"Shipping_City": null,
"Shipping_Country": null,
"Shipping_Code": null,
"Billing_City": null,
"Billing_State": null,
"Created_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"$approval_state": "approved",
"Shipping_Street": null
},
{
"Owner": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Description": null,
"$currency_symbol": "$",
"Shipping_State": null,
"Website": null,
"$followers": null,
"Last_Activity_Time": "2020-10-21T15:10:33+00:00",
"Industry": null,
"Modified_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Phone": null,
"Billing_Country": null,
"Account_Name": "fd fd",
"id": "529793000000425114",
"Modified_Time": "2020-10-09T19:13:17+00:00",
"Billing_Street": null,
"Created_Time": "2020-10-09T19:13:17+00:00",
"$followed": false,
"$editable": true,
"Billing_Code": null,
"Shipping_City": null,
"Shipping_Country": null,
"Shipping_Code": null,
"Billing_City": null,
"Billing_State": null,
"Created_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"$approval_state": "approved",
"Shipping_Street": null
},
{
"Owner": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Description": null,
"$currency_symbol": "$",
"Shipping_State": null,
"Website": null,
"$followers": null,
"Last_Activity_Time": "2020-10-21T15:10:33+00:00",
"Industry": null,
"Modified_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Phone": null,
"Billing_Country": null,
"Account_Name": "klm kdffd",
"id": "529793000000425031",
"$approved": true,
"Modified_Time": "2020-10-09T19:13:17+00:00",
"Billing_Street": null,
"Created_Time": "2020-10-09T19:13:17+00:00",
"$followed": false,
"$editable": true,
"Billing_Code": null,
"Shipping_City": null,
"Shipping_Country": null,
"Shipping_Code": null,
"Billing_City": null,
"Billing_State": null,
"Created_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"$approval_state": "approved",
"Shipping_Street": null
},
{
"Owner": {
"name": "R Natasha",
"id": "529793000000227013",
"email": "natasha@zylker.com"
},
"Description": null,
"$currency_symbol": "$",
"Shipping_State": null,
"Website": null,
"$followers": [
{
"name": "Patrcia",
"id": "529793000000230212"
}
],
"Last_Activity_Time": "2020-10-20T19:13:19+00:00",
"Industry": null,
"Modified_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"Phone": null,
"Billing_Country": null,
"Account_Name": "Test company",
"id": "529793000000390003",
"$approved": true,
"Modified_Time": "2020-09-07T07:17:23+00:00",
"Billing_Street": null,
"Created_Time": "2020-09-07T07:17:23+00:00",
"$followed": true,
"$editable": true,
"Billing_Code": null,
"Shipping_City": null,
"Shipping_Country": null,
"Shipping_Code": null,
"Billing_City": null,
"Billing_State": null,
"Created_By": {
"name": "Patrcia",
"id": "529793000000230212",
"email": "patricia.b@zylker.com"
},
"$approval_state": "approved",
"Shipping_Street": null
}
],
"info": {
"per_page": 200,
"count": 4,
"page": 1,
"more_records": false
}
}