- 记录 API - 示例
- 从线索模块的第 1 页获取记录
- 获取已批准的记录
- 获取已转化的记录
- 获取包含公司字段的记录
- 按条件搜索记录
- 按关键字搜索记录
获取记录 - 示例
本节中使用的例子使用REST API资源来检索、插入、更新和删除记录,以及其他与记录相关的操作。
从线索模块的第1页获取记录列表
用途
从线索模块的第1页获取记录列表。
请求 URL
https://www.zohoapis.com.cn/crm/v2/{module_api_name}
module_api_name - 模块的API名称。
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(event),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注,审批,数据分析,搜索和活动(activities) | ALL - 对记录的完全访问 READ - 从模块获取记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 | 可能的值 |
---|---|---|---|
fields(可选) | 字符串 | 列出所有关于某字段的模块记录 | 用逗号分隔多个字段 API 名称。例如:Last_Name,Email |
sort_order (可选) | 字符串 | 通过升序或降序对可用的记录列表进行排序 | asc - 升序排序 desc - 降序排序 |
sort_by (可选) | 字符串 | 根据给定的字段对可用的记录列表进行排序 | 字段 API 名称 例如:Email |
converted (可选) | 字符串 | 获取已转化的记录列表 | true - 只获取已转化的记录 false - 只获取未转化的记录 both - 获取所有记录 |
approved (可选) | 字符串 | 获取已批准的记录列表 | true - 只获取已批准的记录 false - 只获取未经批准的记录 both - 获取所有记录 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 | 只支持正整数值 |
per_page (可选) | 整型 | 获取每页的可用记录列表。每页的默认值是 200。 | 只支持正整数值 |
cvid (可选) | 整型 | 根据自定义视图获取记录列表 | {custom_view_id} |
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads?page=1&per_page=2"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52
样本响应:
▼{
"data": ▼[
▼{
"Zip_Code": null,
"Street": null,
"Phone": null,
"Annual_Revenue": 0,
"Modified_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Custom_Date_Time": null,
"Lead_Owner": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Lead_Source": null,
"Created_Time": "2016-05-31T15:01:22+05:30",
"DATETIME": null,
"Last_Activity_Time": "2016-05-31T15:03:17+05:30",
"$approved": true,
"id": "4129630000101029",
"$full_name": "Jasmine Frank",
"$converted_detail": {},
"Exchange_Rate": 1,
"Mobile": null,
"Auto_Number_1": "pre8post",
"Company": "Bridgford Foods Corporation",
"Skype_ID": null,
"Currency": "INR",
"Email_Opt_Out": false,
"Description": null,
"Website": null,
"Last_Name": "Smith",
"Fax": null,
"$converted": false,
"URL_1": null,
"Country": null,
"Modified_Time": "2016-05-31T15:03:17+05:30",
"Created_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"City": null,
"Lookup_1": null,
"Formula_1": null,
"Lead_Status": null,
"New_Layout_Multi_Line": null,
"No_of_Employees": 0,
"State": null,
"Email": "bob.d@bridgeford.com",
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"Secondary_Email": null,
"Designation": "Manager",
"Twitter": null,
"Industry": null
},
▼{
"Zip_Code": null,
"Street": null,
"Phone": null,
"Annual_Revenue": 0,
"Modified_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Custom_Date_Time": null,
"Lead_Owner": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Lead_Source": null,
"Created_Time": "2016-04-29T15:16:00+05:30",
"DATETIME": null,
"Last_Activity_Time": "2016-05-28T04:39:31+05:30",
"$approved": true,
"id": "4129630001036001",
"$full_name": "Eric Lidow",
"$converted_detail": {},
"Exchange_Rate": 1,
"Mobile": null,
"Auto_Number_1": null,
"Company": "International Rectifier Corp",
"Skype_ID": null,
"Currency": "INR",
"Email_Opt_Out": false,
"Description": null,
"Website": null,
"Last_Name": "Lidow",
"Fax": null,
"$converted": false,
"URL_1": null,
"Country": null,
"Modified_Time": "2016-05-28T04:39:31+05:30",
"Created_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"City": null,
"Lookup_1": ▼{
"id": "4129630000876009",
"name": "Account for Cases"
},
"Formula_1": null,
"Lead_Status": null,
"New_Layout_Multi_Line": null,
"No_of_Employees": 0,
"State": null,
"Email": null,
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"Secondary_Email": null,
"Designation": "Manager",
"Twitter": null,
"Industry": null
}
],
"info": ▼{
"per_page": 2,
"count": 2,
"page": 1,
"more_records": true
}
}
获取已批准的记录
用途
用来获取已批准的记录列表
请求 URL
https://www.zohoapis.com.cn/crm/v2/Tasks?approved=true
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(event),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注,审批,数据分析,搜索和活动(activities) | ALL - 对记录的完全访问 READ - 从模块获取记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 | 可能的值 |
---|---|---|---|
fields(可选) | 字符串 | 列出所有关于某字段的模块记录 | 用逗号分隔多个字段 API 名称。例如:Last_Name,Email |
sort_order (可选) | 字符串 | 按升序或降序对可用的记录列表进行排序 | asc - 升序排序 desc - 降序排序 |
sort_by (可选) | 字符串 | 根据给定的字段对可用的记录列表进行排序 | 字段 API 名称 例如:Email |
converted (可选) | 字符串 | 获取已转化的记录列表 | true - 只获取已转化的记录 false - 只获取未转化的记录 both - 获取所有记录 |
approved (可选) | 字符串 | 获取已批准的记录列表 | true - 只获取已批准的记录 false - 只获取未经批准的记录 both - 获取所有记录 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 | 只支持正整数值 |
per_page (可选) | 整型 | 获取每页的可用记录列表。每页的默认值是 200。 | 只支持正整数值 |
cvid (可选) | 整型 | 根据自定义视图获取记录列表 | {custom_view_id} |
请求方法
GET
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Tasks?approved=true"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52
样本响应:
▼{
"data": ▼[
▼{
"Who_Id": null,
"Description": null,
"Modified_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Subject": "fdfd",
"Remind_At": null,
"Task_Owner": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Due_Date": "2016-04-18",
"Created_Time": "2016-04-18T16:01:04+05:30",
"Modified_Time": "2016-04-18T16:01:04+05:30",
"Created_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"$approved": true,
"Priority": "High",
"id": "412963000001009001",
"Status": "Not Started",
"What_Id": ▼{
"id": "412963000000913002",
"name": "Bob Delong"
},
"Exchange_Rate": 1,
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"$se_module": "Accounts",
"Send_Notification_Email": false,
"Closed_Time": null,
"Currency": "INR",
"Recurring_Activity": null
}
],
"info": ▼{
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
获取已转化的记录
用途
用来获取已转化的记录列表。
请求 URL
https://www.zohoapis.com.cn/crm/v2/Leads?converted=true
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(event),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注,审批,数据分析,搜索和活动(activities) | ALL - 对记录的完全访问 READ - 从模块获取记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 | 可能的值 |
---|---|---|---|
fields(可选) | 字符串 | 列出所有关于某字段的模块记录 | 用逗号分隔多个字段 API 名称。例如:Last_Name,Email |
sort_order (可选) | 字符串 | 按升序或降序对可用的记录列表进行排序 | asc - 升序排序 desc - 降序排序 |
sort_by (可选) | 字符串 | 根据给定的字段对可用的记录列表进行排序 | 字段 API 名称 例如:Email |
converted (可选) | 字符串 | 用来获取已转化的记录列表 | true - 只获取已转化的记录 false - 只获取未转化的记录 both - 获取所有记录 |
approved (可选) | 字符串 | 用来获取已批准的记录列表 | true - 只获取已批准的记录 false - 只获取未经批准的记录 both - 获取所有记录 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 | 只支持正整数值 |
per_page (可选) | 整型 | 获取每页的可用记录列表。每页的默认值是 200。 | 只支持正整数值 |
cvid (可选) | 整型 | 根据自定义视图获取记录列表 | {custom_view_id} |
请求方法
GET
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads?converted=true"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52
样本响应:
▼{
"data": ▼[
▼{
"Zip_Code": null,
"Street": null,
"Phone": null,
"Annual_Revenue": 0,
"Modified_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Custom_Date_Time": null,
"Lead_Owner": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"Lead_Source": null,
"Created_Time": "2016-05-31T15:00:04+05:30",
"DATETIME": null,
"Last_Activity_Time": "2016-05-31T15:00:51+05:30",
"$approved": true,
"id": "4129630001101013",
"$full_name": "Bridgette Johnson",
"$converted_detail": ▼{
"converted_by": "4129630000088003",
"potential": null,
"account": "41296300001101004",
"contact": "41296300001101017",
"convert_date": "2016-05-31T20:30:51+05:29"
},
"Exchange_Rate": 1,
"Mobile": null,
"Auto_Number_1": "pre7post",
"Company": "Firstbright Agency",
"Skype_ID": null,
"Currency": "INR",
"Email_Opt_Out": false,
"Description": null,
"Website": null,
"Last_Name": "Johnson",
"Fax": null,
"$converted": true,
"URL_1": null,
"Country": null,
"Modified_Time": "2016-05-31T15:00:51+05:30",
"Created_By": ▼{
"id": "4129630000088003",
"name": "Patricia Boyle"
},
"City": null,
"Lookup_1": null,
"Formula_1": null,
"Lead_Status": "Pre Qualified",
"New_Layout_Multi_Line": null,
"No_of_Employees": 60,
"State": null,
"Email": null,
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"Secondary_Email": null,
"Designation": "Mr",
"Twitter": null,
"Industry": null
}
],
"info": ▼{
"per_page": 200,
"count": 105,
"page": 1,
"more_records": false
}
}
获取包含公司字段的记录
用途
获取包含公司字段的记录列表。
请求 URL
https://www.zohoapis.com.cn/crm/v2/Leads?fields=Company
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(event),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注,审批,数据分析,搜索和活动(activities) | ALL - 对记录的完全访问 READ - 从模块获取记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 | 可能的值 |
---|---|---|---|
fields(可选) | 字符串 | 列出所有关于某字段的模块记录 | 用逗号分隔多个字段 API 名称。例如:Last_Name,Email |
sort_order (可选) | 字符串 | 按升序或降序对可用的记录列表进行排序 | asc - 升序排序 desc - 降序排序 |
sort_by (可选) | 字符串 | 根据给定的字段对可用的记录列表进行排序 | 字段 API 名称 示例: Email |
converted (可选) | 字符串 | 获取已转化的记录列表 | true - 只获取已转化的记录 false - 只获取未转化的记录 both - 获取所有记录 |
approved (可选) | 字符串 | 获取已批准的记录列表 | true - 只获取已批准的记录 false - 只获取未经批准的记录 both - 获取所有记录 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 | 只支持正整数值 |
per_page (可选) | 整型 | 获取每页的可用记录列表。每页的默认值是 200。 | 只支持正整数值 |
cvid (可选) | 整型 | 基于自定义视图获取记录列表 | {custom_view_id} |
请求方法
GET
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads?fields=Company"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52
样本响应:
▼{
"data": ▼[
▼{
"id": "4108880000607757",
"$full_name": "Last_Name1",
"$converted_detail": {},
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"$converted": false,
"Company": "Company1",
"$approved": true
},
▼{
"id": "4108880000605780",
"$full_name": "Last_Name1",
"$converted_detail": {},
"$approval": ▼{
"approve": false,
"reject": false,
"delegate": false
},
"$converted": false,
"Company": "Company1",
"$approved": true
}
],
"info": ▼{
"per_page": 200,
"count": 200,
"page": 1,
"more_records": true
}
}
按照条件搜素记录
用途
检索与您的搜索条件匹配的记录
请求 URL
https://www.zohoapis.com.cn/crm/v2/{module_api_name}/search
module_api_name - 模块的API名称。
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(events),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注和活动(activities)。 | ALL - 对记录的完全访问 READ - 获取模块中的记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 |
---|---|---|
criteria | 字符串 | 按照下面显示的条件执行搜索。 (({apiname}:{starts_with|equals}:{value}) 和 ({apiname}:{starts_with|equals}:{value})) 你可以最多通过 10 个条件(相同或不同列)执行搜索,如上所示条件包含“等于(equals)”和“开始于(starts_with)”。 |
字符串 | {email} - 按照邮箱执行模块搜索。指定模块的所有邮箱字段都将被搜索和列出。 | |
phone | 字符串 | {Phone} - 按照电话号码执行模块搜索。指定模块的所有电话字段都将被搜索和列出。 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 |
per_page (可选) | 整型 | 获取每页的可用记录列表。每页的默认值是 200。 |
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads/search?criteria=((Last_Name:starts_with:G) and (Email:equals:deborah@healthnet.com))"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52"
样本请求:
Search by Phone:
ZCRMModule module = ZCRMModule.getInstance("Contacts"); // 模块 API 名称
BulkAPIResponse response = module.searchByPhone("123456789", 1, 10);// 获取某页的某几条记录
List<ZCRMRecord> records = (List<ZCRMRecord>) response.getData(); //匹配的记录
样本请求:
Search by Email:
ZCRMModule module = ZCRMModule.getInstance("Contacts"); // 模块 API 名称
BulkAPIResponse response = module.searchByEmail("bruce@wayne.com", 1, 10);// 获取某页的某几条记录
List<ZCRMRecord> records = (List<ZCRMRecord>) response.getData(); //匹配的记录
样本请求:
$zcrmModuleIns = ZCRMModule::getInstance("Products");
$bulkAPIResponse=$zcrmModuleIns->searchRecords("ip");
$records = $bulkAPIResponse->getData(); // $records - ZCRMRecord 的实例数组。
样本请求:
zclient, api_obj = ZohoCRMClient.get_client_objects(conf_file_location)
accounts_module = api_obj.load_crm_module(“Accounts”)
records = accounts_module.search_records(“test”, “test@domain.com“)
records.each do |r_id, r_obj|
print “r_id”, “r_obj.class”
end
样本请求:
try:
module_ins=ZCRMModule.get_instance('Products') #module API Name
resp=module_ins.search_records('Orange') #search key word
print resp.status_code
resp_info=resp.info
print resp_info.count
print resp_info.page
print resp_info.per_page
print resp_info.is_more_records
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
样本响应:按照条件
▼{
"data": ▼[
▼{
"Owner": ▼{
"name": "Patricia Boyle",
"id": "2883756000000133013"
},
"Company": "Health Net Inc",
"Email": "deborah@healthnet.com",
"Description": null,
"$currency_symbol": "$",
"Twitter": null,
"Last_Activity_Time": "2018-02-14T13:41:00+05:30",
"First_Name": "Deborah",
"Full_Name": "Deborah Grogan",
"Lead_Status": "Lost Lead",
"Industry": "ERP",
"Modified_By": ▼{
"name": "Chakra",
"id": "2883756000000133013"
},
"Skype_ID": null,
"Phone": "888-555-5478",
"id": "2883756000000135187",
"Email_Opt_Out": true,
"$approved": true,
"Designation": "IT MGR",
"Modified_Time": "2018-02-14T13:41:00+05:30",
"Created_Time": "2017-12-20T11:56:47+05:30",
"City": "Woodland Hills",
"No_of_Employees": 50,
"Mobile": "865-555-5478",
"Last_Name": "Grogan",
"Lead_Source": "Employee Referral",
"Country": "United States",
"Created_By": ▼{
"name": "Patricia Boyle",
"id": "2883756000000133013"
}
}
],
"info": ▼{
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}
按照邮箱搜索记录
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads/search?email=p.daly@zylker.com"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52"
样本响应:
▼{
"data": ▼[
▼{
"Company": "Zylker",
"Email": "p.daly@zylker.com",
"Last_Activity_Time": "2016-09-22T12:16:06+05:30",
"Industry": null,
"$converted": false,
"Exchange_Rate": 1,
"Currency": "INR",
"Date_2": null,
"Street": null,
"Zip_Code": null,
"id": "410888000000698005",
"$approved": true,
"$approval": ▼{
"delegate": false,
"approve": false,
"reject": false
},
"Date_Time": null,
"Created_Time": "2016-08-09T16:27:04+05:30",
"$followed": false,
"Owner": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"City": null,
"No_of_Employees": 0,
"State": "Texas",
"Country": null,
"Created_By": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"Annual_Revenue": 0,
"Secondary_Email": null,
"Description": null,
"Decimal_1": null,
"Website": null,
"Twitter": null,
"Salutation": null,
"First_Name": "Paul",
"Lead_Status": null,
"Full_Name": "Paul Daly",
"Modified_By": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"Skype_ID": null,
"Phone": "888-555-2145",
"Picks3": null,
"Picks2": null,
"Email_Opt_Out": false,
"Date_Time_2": null,
"Long_Integer_1": null,
"Designation": null,
"Date_Testing": null,
"Modified_Time": "2016-09-22T12:16:06+05:30",
"Pick_List_2": null,
"Picks1": null,
"$converted_detail": {},
"Pick_List_1": null,
"Mobile": null,
"Last_Name": "Daly",
"Layout": ▼{
"name": "Standard",
"id": "410888000000380037"
},
"Auto_Number_1": "Test627Test",
"Lead_Source": null,
"Formula_1": 4,
"Fax": null,
"Lookup_1": null
}
],
"info": ▼{
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}
按照条件搜索记录
用途
根据特定的单词检索记录
请求 URL
https://www.zohoapis.com.cn/crm/v2/{module_api_name}/search
module_api_name - 模块的API名称。
作用域
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
可能的模块名称 | 可能的操作类型 |
---|---|
线索,客户,联系人,商机,市场活动,任务,服务支持,活动(events),通话,解决方案,产品,供货商,价格表,报价,销售订单,采购订单,发货单,定制模块,备注和活动(activities)。 | ALL - 对记录的完全访问 READ - 获取模块中的记录 |
请求方法
GET
参数
参数名称 | 数据类型 | 描述 |
---|---|---|
字符串 | {email} - 按照邮箱执行模块搜索。指定模块的所有邮箱字段都将被搜索和列出。 | |
phone | 字符串 | {Phone} - 按照电话号码执行模块搜索。指定模块的所有电话字段都将被搜索和列出。 |
word | 字符串 | {Word}- 按照指定关键字执行全局搜索。 |
page (可选) | 整型 | 从指定页中获取记录列表。页面编号默认值是 1。 |
per_page (可选) | 整型 | 获取每个页面的可用记录列表。每页的默认值是 200。 |
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads/search?word=Partner"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52"
样本请求:
Search by Phone:
ZCRMModule module = ZCRMModule.getInstance("Contacts"); // 模块 API 名称
BulkAPIResponse response = module.searchByPhone("123456789", 1, 10);// 获取某页的某几条搜索记录
List<ZCRMRecord> records = (List<ZCRMRecord>) response.getData(); //匹配的记录
样本请求:
按照邮箱搜索:
ZCRMModule module = ZCRMModule.getInstance("Contacts"); // 模块 API 名称
BulkAPIResponse response = module.searchByEmail("bruce@wayne.com", 1, 10);// 获取某页的某几条搜索记录
List<ZCRMRecord> records = (List<ZCRMRecord>) response.getData(); //匹配的记录
样本请求:
$zcrmModuleIns = ZCRMModule::getInstance("Products");
$bulkAPIResponse=$zcrmModuleIns->searchRecords("ip");
$records = $bulkAPIResponse->getData(); // $records - ZCRMRecord 的实例数组。
样本请求:
zclient, api_obj = ZohoCRMClient.get_client_objects(conf_file_location)
accounts_module = api_obj.load_crm_module(“Accounts”)
records = accounts_module.search_records(“test”, “test@domain.com“)
records.each do |r_id, r_obj|
print “r_id”, “r_obj.class”
end
样本请求:
try:
module_ins=ZCRMModule.get_instance('Products') #module API Name
resp=module_ins.search_records('Orange') #search key word
print resp.status_code
resp_info=resp.info
print resp_info.count
print resp_info.page
print resp_info.per_page
print resp_info.is_more_records
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
样本响应:按照关键字
▼{
"data": ▼[
▼{
"Owner": ▼{
"name": "Chakra",
"id": "2883756000000133013"
},
"Company": "Health Net Inc",
"Last_Activity_Time": "2017-12-20T11:56:47+05:30",
"First_Name": "Fred",
"Full_Name": "Fred Nainavaii",
"Industry": "ASP",
"Modified_By": ▼{
"name": "Chakra",
"id": "2883756000000133013"
},
"Phone": "888-555-3456",
"Street": "21281 Burbank Blvd",
"Zip_Code": "91367-7073",
"id": "2883756000000135184",
"Email_Opt_Out": true,
"Designation": "Manager of IS Applications",
"Modified_Time": "2017-12-20T11:56:47+05:30",
"Created_Time": "2017-12-20T11:56:47+05:30",
"City": "Woodland Hills",
"No_of_Employees": 600,
"Mobile": "865-555-3456",
"Last_Name": "Nainavaii",
"Lead_Source": "Partner",
"Country": "United States",
"Created_By": ▼{
"name": "Chakra",
"id": "2883756000000133013"
}
},
▼{
"Owner": ▼{
"name": "Chakra",
"id": "2883756000000133013"
},
"Company": "W M C Mortgage Corporation",
"Email": "d.kajiwara@wmc.com",
"Last_Activity_Time": "2017-12-20T11:56:47+05:30",
"First_Name": "Doug",
"Full_Name": "Doug Kajiwara",
"Lead_Status": "Contacted",
"Industry": "ASP",
"Modified_By": ▼{
"name": "Chakra",
"id": "2883756000000133013"
},
"Skype_ID": null,
"Phone": "888-555-5578",
"Street": "6320 Canoga Ave",
"Zip_Code": "91367-2526",
"id": "2883756000000135078",
"Email_Opt_Out": false,
"Designation": "Network Manager",
"Modified_Time": "2017-12-20T11:56:47+05:30",
"Created_Time": "2017-12-20T11:56:47+05:30",
"City": "Woodland Hills",
"No_of_Employees": 800,
"Mobile": "865-555-5578",
"Last_Name": "Kajiwara",
"State": "CA",
"Lead_Source": "Partner",
"Created_By": ▼{
"name": "Chakra",
"id": "2883756000000133013"
}
}
],
"info": ▼{
"per_page": 200,
"count": 2,
"page": 1,
"more_records": false
}
}
备注:
- 由于搜索关键字是“合作伙伴”,响应将显示任意字段中包含“合作伙伴”关键字的所有记录。
按照邮箱搜索
样本请求:
curl "https://www.zohoapis.com.cn/crm/v2/Leads/search?email=p.daly@zylker.com"
-X GET
-H "Authorization: Zoho-oauthtoken d92d401c803988c5cb849d0b4215f52"
样本响应:
▼{
"data": ▼[
▼{
"Company": "Zylker",
"Email": "p.daly@zylker.com",
"Last_Activity_Time": "2016-09-22T12:16:06+05:30",
"Industry": null,
"$converted": false,
"Exchange_Rate": 1,
"Currency": "INR",
"Date_2": null,
"Street": null,
"Zip_Code": null,
"id": "410888000000698005",
"$approved": true,
"$approval": ▼{
"delegate": false,
"approve": false,
"reject": false
},
"Date_Time": null,
"Created_Time": "2016-08-09T16:27:04+05:30",
"$followed": false,
"Owner": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"City": null,
"No_of_Employees": 0,
"State": "Texas",
"Country": null,
"Created_By": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"Annual_Revenue": 0,
"Secondary_Email": null,
"Description": null,
"Decimal_1": null,
"Website": null,
"Twitter": null,
"Salutation": null,
"First_Name": "Paul",
"Lead_Status": null,
"Full_Name": "Paul Daly",
"Modified_By": ▼{
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"Skype_ID": null,
"Phone": "888-555-2145",
"Picks3": null,
"Picks2": null,
"Email_Opt_Out": false,
"Date_Time_2": null,
"Long_Integer_1": null,
"Designation": null,
"Date_Testing": null,
"Modified_Time": "2016-09-22T12:16:06+05:30",
"Pick_List_2": null,
"Picks1": null,
"$converted_detail": {},
"Pick_List_1": null,
"Mobile": null,
"Last_Name": "Daly",
"Layout": ▼{
"name": "Standard",
"id": "410888000000380037"
},
"Auto_Number_1": "Test627Test",
"Lead_Source": null,
"Formula_1": 4,
"Fax": null,
"Lookup_1": null
}
],
"info": ▼{
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}