记录API
记录是存储从各种来源获得的特定联系人或公司的所有组合信息的实体。这些信息可以通过web表单、社交平台、广告等获取。 记录API允许用户获取、创建、更新、删除或搜索记录。
目的
从模块中获取可用记录的列表。
请求URL
https://www.zohoapis.com.cn/crm/v2/{module_api_name}
module_api_name - 模块的API名称
支持的模块 |
---|
线索,客户,联系人,商机,市场活动,任务,服务支持,事件,通话,解决方案,产品,供货商,价格表,报价单,销售订单,采购订单,发货单,自定义模块,备注和活动 |
请求方法
GET
范围
scope=ZohoCRM.modules.all
(或)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,事件,通话,解决方案,产品,供货商,价格表,报价单,销售订单,采购订单,自定义模块,备注和活动。 | ALL - 完全访问记录 READ - 从模块中获取记录 |
参数
参数名称 | 数据类型 | 描述 | 可能的值 |
---|---|---|---|
fields (可选) | 字符串 | 列出与字段有关的所有模块记录 | 多个字段API名称,逗号分隔。例如:Last_Name,Email |
sort_order (可选) | 字符串 | 按升序或降序对可用记录列表进行排序 | asc - 升序 desc - 降序 |
sort_by (可选) | 字符串 | 根据给定字段对可用记录列表进行排序 | 字段API名称 例如:Email |
converted (可选) | 字符串 | 用来获取已转换记录的列表。默认值是false | true - 只获取已转换的记录 false - 只获取未转换的记录 both - 获取所有记录 |
approved (可选) | 字符串 | 用来获取已审批的记录列表。默认值是true。 | true - 只获取已审批的记录 false - 只获取未审批的记录 both - 获取所有记录 |
page (可选) | 整型 | 从相关页面获取记录列表。 page的默认值是1。 | 只取正整数 |
per_page (可选) | 整型 | 获取每页可用记录的列表
page的默认值是200。 | 只取正整数 |
cvid (可选) | 整型 | 获取基于自定义视图的记录列表 | {custom_view_id} |
备注:
sort_order适用于给定的sort_by字段。
如果未提供sort_by字段,则它应用于系统定义的字段。
page和per_page参数用于根据记录在CRM中的位置获取记录。假设用户必须获取400条记录。一个API调用最多可以获得200条记录。因此,对于第200条以上的记录,无法获取。 通过使用 page (1, 2, 3 和 4) 和 per_page (100) 参数,用户可以使用4个API调用获取所有400条记录。
参考响应结构了解更多有关JSON键、值及其描述的详细信息。
请求报头
报头名称 | 数据类型 | 描述 | 示例 |
---|---|---|---|
If-Modified-Since (可选) | DateTime (ISO 8601 格式) | 获取最近修改的记录列表 | 2019-07-25T15:26:49+05:30 |
可能的错误
HTTP状态 | 错误码 | 消息 | 原因 |
---|---|---|---|
400 | INVALID_MODULE | 给出的模块名称似乎无效 | 无效的模块名称或没有选项卡权限,或者模块可能已从已组织的模块中删除 |
400 | INVALID_MODULE | 在API中不支持给定的模块 | 当前API不支持文档和项目等模块。(一旦支持了这些模块,就不会显示此错误。) |
备注:
在检索多个记录时,不会检索子表单记录。只检索子表单中的记录计数。
要获取子表单中的记录细节,需要在模块中获取特定的记录信息。
示例属性
属性 | 示例 |
---|---|
单行 | "Single_Line_1": "This is single line", |
多行 | "Multi_Line_1": "This is the first line \n Now for the second Line", |
邮箱 | "Email_1": "p.boyle@zylker.com", |
电话 | "Phone_1": "9900000000", |
选择列表 | "Picklist_1" : "In Progress", |
多选列表 | "Multi-Select_Picklist" : [ "{Option_1}", "{Option_2}", "{Option_3}" ], |
日期 | "Date_1": "2017-08-16", |
日期/时间 | "Date_Time": "2017-08-16T14:32:23+05:30", |
数字 | "Number_1": 575, |
货币 | "Currency_1": 250000, |
小数 | "Decimal_1": 250000.50, |
百分比 | ""Percent_1": 25, |
长整型 | "Long_Integer_1": "250000000000000", |
复选框 | "Checkbox_1": false, |
URL | URL_1": "https://www.zoho.com/crm", |
查找 | "Lookup" : { "name" : "James" "id" : "425248000000104001" }, |
Record Owner | "Owner": { "name" : "Patricia" "id": "425248000000104003" }, |
Layout | "Layout": { "name" : "Custom Layout 1" "id": "425248000000404433" }, |
Auto number | "Auto_Number_1": "LEAD44N", 在这里, LEAD - 前缀, 44 - 分配号 和 N - 后缀。 |
示例请求
curl "https://www.zohoapis.com.cn/crm/v2/Leads"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
示例响应
{
"data": [
{
"Zip_Code": null,
"Long_Integer_1": null,
"Annual_Revenue": 0,
"Owner": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Date_2": null,
"Created_Time": "2016-06-21T17:11:37+05:30",
"Last_Activity_Time": "2016-06-21T17:11:37+05:30",
"$full_name": "Jennifer Donelly",
"Mobile": null,
"Currency": "INR",
"Pick_List_2": null,
"Pick_List_1": null,
"Date_Time_2": null,
"Modified_Time": "2016-06-21T17:11:37+05:30",
"Country": "United States",
"Created_By": {
"id": "4108880000006001",
"name": "Patricia Boyle"
},
"Formula_1": 9,
"Layout": {
"id": "4108880000380037",
"name": "Standard"
},
"Email": "jennifer@acme.com",
"Secondary_Email": null,
"Designation": null,
"Industry": null,
"Twitter": null,
"Phone": null,
"Street": null,
"Modified_By": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Picks1": null,
"Lead_Source": null,
"$approved": true,
"id": "4108880000610005",
"$converted_detail": {},
"Date_Testing": null,
"Exchange_Rate": 1,
"Auto_Number_1": "Test609Test",
"Skype_ID": null,
"Company": "AcmeInc",
"Email_Opt_Out": false,
"Decimal_1": null,
"Description": null,
"Website": null,
"Fax": null,
"Last_Name": "Donelly",
"$converted": false,
"City": "Cheni",
"Lookup_1": null,
"Lead_Status": null,
"No_of_Employees": 0,
"State": "Texas1",
"$approval": {
"approve": false,
"reject": false,
"delegate": false
},
"Date_Time": null,
"Picks3": null,
"Picks2": null
}
],
"info": {
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
示例请求
ZCRMModule module = ZCRMModule.getInstance("Products");
BulkAPIResponse response = module.getRecords(425476547854l, "Company",
CommonUtil.SortOrder.asc, 1, 4);// 使用cvID、sortField、sortOrder、startIndex和endIndex获取记录。
List<ZCRMRecord> records = (List<ZCRMRecord>)response.getData();
示例响应
{
"data": [
{
"Zip_Code": null,
"Long_Integer_1": null,
"Annual_Revenue": 0,
"Owner": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Date_2": null,
"Created_Time": "2016-06-21T17:11:37+05:30",
"Last_Activity_Time": "2016-06-21T17:11:37+05:30",
"$full_name": "Jennifer Donelly",
"Mobile": null,
"Currency": "INR",
"Pick_List_2": null,
"Pick_List_1": null,
"Date_Time_2": null,
"Modified_Time": "2016-06-21T17:11:37+05:30",
"Country": "United States",
"Created_By": {
"id": "4108880000006001",
"name": "Patricia Boyle"
},
"Formula_1": 9,
"Layout": {
"id": "4108880000380037",
"name": "Standard"
},
"Email": "jennifer@acme.com",
"Secondary_Email": null,
"Designation": null,
"Industry": null,
"Twitter": null,
"Phone": null,
"Street": null,
"Modified_By": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Picks1": null,
"Lead_Source": null,
"$approved": true,
"id": "4108880000610005",
"$converted_detail": {},
"Date_Testing": null,
"Exchange_Rate": 1,
"Auto_Number_1": "Test609Test",
"Skype_ID": null,
"Company": "AcmeInc",
"Email_Opt_Out": false,
"Decimal_1": null,
"Description": null,
"Website": null,
"Fax": null,
"Last_Name": "Donelly",
"$converted": false,
"City": "Cheni",
"Lookup_1": null,
"Lead_Status": null,
"No_of_Employees": 0,
"State": "Texas1",
"$approval": {
"approve": false,
"reject": false,
"delegate": false
},
"Date_Time": null,
"Picks3": null,
"Picks2": null
}
],
"info": {
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
示例请求
$zcrmModuleIns = ZCRMModule::getInstance("Contacts");
$bulkAPIResponse=$zcrmModuleIns->getRecords();
$recordsArray = $bulkAPIResponse->getData(); // $recordsArray - ZCRMRecord 实例数组
示例响应
{
"data": [
{
"Zip_Code": null,
"Long_Integer_1": null,
"Annual_Revenue": 0,
"Owner": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Date_2": null,
"Created_Time": "2016-06-21T17:11:37+05:30",
"Last_Activity_Time": "2016-06-21T17:11:37+05:30",
"$full_name": "Jennifer Donelly",
"Mobile": null,
"Currency": "INR",
"Pick_List_2": null,
"Pick_List_1": null,
"Date_Time_2": null,
"Modified_Time": "2016-06-21T17:11:37+05:30",
"Country": "United States",
"Created_By": {
"id": "4108880000006001",
"name": "Patricia Boyle"
},
"Formula_1": 9,
"Layout": {
"id": "4108880000380037",
"name": "Standard"
},
"Email": "jennifer@acme.com",
"Secondary_Email": null,
"Designation": null,
"Industry": null,
"Twitter": null,
"Phone": null,
"Street": null,
"Modified_By": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Picks1": null,
"Lead_Source": null,
"$approved": true,
"id": "4108880000610005",
"$converted_detail": {},
"Date_Testing": null,
"Exchange_Rate": 1,
"Auto_Number_1": "Test609Test",
"Skype_ID": null,
"Company": "AcmeInc",
"Email_Opt_Out": false,
"Decimal_1": null,
"Description": null,
"Website": null,
"Fax": null,
"Last_Name": "Donelly",
"$converted": false,
"City": "Cheni",
"Lookup_1": null,
"Lead_Status": null,
"No_of_Employees": 0,
"State": "Texas1",
"$approval": {
"approve": false,
"reject": false,
"delegate": false
},
"Date_Time": null,
"Picks3": null,
"Picks2": null
}
],
"info": {
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
示例请求
def get_records(self):
try:
module_ins=ZCRMModule.get_instance('Products') #模块API名称
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
示例请求
语法:
zoho.crm.getRecords(<module String>,<page Long>,<perPage Long>,<optionalDataMap Map>,<connectionName String>,<userAccess Boolean>);
mandatory : module
示例请求:
resp = zoho.crm.getRecords("Leads",5,2,{"converted":"false"});
示例响应
{
"data": [
{
"Zip_Code": null,
"Long_Integer_1": null,
"Annual_Revenue": 0,
"Owner": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Date_2": null,
"Created_Time": "2016-06-21T17:11:37+05:30",
"Last_Activity_Time": "2016-06-21T17:11:37+05:30",
"$full_name": "Jennifer Donelly",
"Mobile": null,
"Currency": "INR",
"Pick_List_2": null,
"Pick_List_1": null,
"Date_Time_2": null,
"Modified_Time": "2016-06-21T17:11:37+05:30",
"Country": "United States",
"Created_By": {
"id": "4108880000006001",
"name": "Patricia Boyle"
},
"Formula_1": 9,
"Layout": {
"id": "4108880000380037",
"name": "Standard"
},
"Email": "jennifer@acme.com",
"Secondary_Email": null,
"Designation": null,
"Industry": null,
"Twitter": null,
"Phone": null,
"Street": null,
"Modified_By": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Picks1": null,
"Lead_Source": null,
"$approved": true,
"id": "4108880000610005",
"$converted_detail": {},
"Date_Testing": null,
"Exchange_Rate": 1,
"Auto_Number_1": "Test609Test",
"Skype_ID": null,
"Company": "AcmeInc",
"Email_Opt_Out": false,
"Decimal_1": null,
"Description": null,
"Website": null,
"Fax": null,
"Last_Name": "Donelly",
"$converted": false,
"City": "Cheni",
"Lookup_1": null,
"Lead_Status": null,
"No_of_Employees": 0,
"State": "Texas1",
"$approval": {
"approve": false,
"reject": false,
"delegate": false
},
"Date_Time": null,
"Picks3": null,
"Picks2": null
}
],
"info": {
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
示例请求
ZCRMModule moduleIns = ZCRMModule.GetInstance("Leads"); //模块API名称
List<string> fields = new List<string> {"Last_Name","Company", "Email","id" }; //字段API名称
BulkAPIResponse<ZCRMRecord> response = moduleIns.GetRecords(3372164000000087503, "Company",CommonUtil.SortOrder.asc, 1, 4, fields);// 使用cvId、sortByField、sortOrder、startIndex、endIndex和fieldApiNamelist获取记录。
List<ZCRMRecord> records = response.BulkData; //records - ZCRMRecord 实例列表
示例响应
{
"data": [
{
"Zip_Code": null,
"Long_Integer_1": null,
"Annual_Revenue": 0,
"Owner": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Date_2": null,
"Created_Time": "2016-06-21T17:11:37+05:30",
"Last_Activity_Time": "2016-06-21T17:11:37+05:30",
"$full_name": "Jennifer Donelly",
"Mobile": null,
"Currency": "INR",
"Pick_List_2": null,
"Pick_List_1": null,
"Date_Time_2": null,
"Modified_Time": "2016-06-21T17:11:37+05:30",
"Country": "United States",
"Created_By": {
"id": "4108880000006001",
"name": "Patricia Boyle"
},
"Formula_1": 9,
"Layout": {
"id": "4108880000380037",
"name": "Standard"
},
"Email": "jennifer@acme.com",
"Secondary_Email": null,
"Designation": null,
"Industry": null,
"Twitter": null,
"Phone": null,
"Street": null,
"Modified_By": {
"id": "4108880000086001",
"name": "Patricia Boyle"
},
"Picks1": null,
"Lead_Source": null,
"$approved": true,
"id": "4108880000610005",
"$converted_detail": {},
"Date_Testing": null,
"Exchange_Rate": 1,
"Auto_Number_1": "Test609Test",
"Skype_ID": null,
"Company": "AcmeInc",
"Email_Opt_Out": false,
"Decimal_1": null,
"Description": null,
"Website": null,
"Fax": null,
"Last_Name": "Donelly",
"$converted": false,
"City": "Cheni",
"Lookup_1": null,
"Lead_Status": null,
"No_of_Employees": 0,
"State": "Texas1",
"$approval": {
"approve": false,
"reject": false,
"delegate": false
},
"Date_Time": null,
"Picks3": null,
"Picks2": null
}
],
"info": {
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}