Related Records Data
A record usually contains additional information such as notes, attachments, products, deals, contacts, etc. Using related lists API, you can retrieve all the related list information.
Get Related Records
Purpose
To get the related list records.
Request Details
Request URL
https://www.zohoapis.com/bigin/v1/{module_api_name}/{record_id}/{related_list_api_name}
Supported relations
Products - to - Contacts, Deals
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
If-Modified-Since: Use this header to get the list of recently modified records. Example: 2019-07-25T15:26:49+05:30
Scope
scope=ZohoBigin.modules.ALL
(or)
scope=ZohoBigin.modules.{module_name}.{operation_type}
Possible module names
Accounts(Companies in Bigin), deals, contacts, products
Possible operation types
ALL - Full access to related records
READ - Read related records
Parameters
- 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.
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.
Sample Request
Copiedcurl "https://www.zohoapis.com/bigin/v1/Contacts/410888000000698006/Notes"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
CopiedZCRMRecord record = ZCRMRecord.getInstance("Contacts", 12345l);//module api name with record id
BulkAPIResponse response = record.getRelatedListRecords("Deals");
List<ZCRMRecord> deals = (List<ZCRMRecord>) response.getData(); //relatedList name
Copied$zcrmRecordIns = ZCRMRecord::getInstance(“Products", 410405000001108011);
$bulkAPIResponse=$zcrmRecordIns->getRelatedListRecords(“Deals”);
$relatedRecordsList=$bulkAPIResponse->getData(); // $relatedRecordsList - array of ZCRMRecord instances which are related to given Product.
Copieddef get_related_records(self):
try:
record = ZCRMRecord.get_instance('Leads', 3719520000000323002) # module API Name, entityId
resp = record.get_relatedlist_records('Products') # related list API Name
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)
print(record_ins.get_field_value('Product_Name'))
print(record_ins.get_field_value('Product_Code'))
print(record_ins.get_field_value('Vendor_Name'))
print(record_ins.get_field_value('Commission_Rate'))
print(record_ins.get_field_value('Qty_in_Demand'))
print(record_ins.get_field_value('Tax'))
print(record_ins.get_field_value('Unit_Price'))
print(record_ins.get_field_value('Reorder_Level'))
print(record_ins.get_field_value('Usage_Unit'))
print(record_ins.get_field_value('Qty_Ordered'))
print(record_ins.get_field_value('Qty_in_Stock'))
print(record_ins.get_field_value('Sales_Start_Date'))
print(record_ins.get_field_value('Sales_End_Date'))
print(record_ins.get_field_value('Taxable'))
print(record_ins.get_field_value('Support_Expiry_Date'))
print(record_ins.get_field_value('Manufacturer'))
print(record_ins.get_field_value('Description'))
print(record_ins.field_data)
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.getRelatedRecords(<module String>,<parentModuleName String>,<recordId Long>,<page Long>,<perPage Long>,<connectionName String>,<userAccess Boolean>);
mandatory : module,parentModuleName,recordId
Sample Request:
resp = zoho.crm.getRelatedRecords("Related_List_Name_2","Leads","7000000037002");
CopiedZCRMRecord recordIns= ZCRMRecord.GetInstance("Leads", 3372164000000); //module api name with record id
BulkAPIResponse<ZCRMRecord> response = recordIns.GetRelatedListRecords("Products"); //RelatedList api name
List<ZCRMRecord> relatedRecordsLists = response.BulkData; //relatedRecordsLists - list of ZCRMRecord instance
Sample Response
Copied{
"data": [
{
"Owner": {
"name": "Patricia Boyle",
"id": "4150868000000225013",
"email": "patricia.b@zylker.com"
},
"Modified_Time": "2020-07-26T15:26:58+05:30",
"$attachments": null,
"Created_Time": "2020-07-26T15:26:58+05:30",
"Parent_Id": {
"name": "patricia boyle",
"id": "4150868000002737001"
},
"$editable": true,
"$se_module": "Leads",
"$is_shared_to_client": false,
"Modified_By": {
"name": "Patricia Boyle",
"id": "4150868000000225013",
"email": "patricia.b@zylker.com"
},
"$size": null,
"$state": "save",
"$voice_note": false,
"id": "4150868000002738003",
"Created_By": {
"name": "Patricia Boyle",
"id": "4150868000000225013",
"email": "patricia.b@zylker.com"
},
"Note_Title": null,
"Note_Content": "This is a sample note."
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}