模块API
Zoho CRM拥有标准的模块,如:线索、客户、联系人、商机、预测、活动等。使用Zoho CRM REST API,您可以检索可用模块列表,如下面的示例所示:
获取模块列表
目的
获取模块相关数据。这将检索CRM帐户中可用的模块列表。
请求URL
https://www.zohoapis.com.cn/crm/v2/settings/modules
请求方法
GET
范围
scope=ZohoCRM.settings.all
(或)
scope=ZohoCRM.settings.modules.{operation_type}
可能的操作类型 |
---|
ALL - 完全数据访问 READ - 获取模块数据 |
属性
"convertable":描述用户是否可以将记录转换为另一种类型的记录。例如:将线索转换为商机。
"creatable":检查用户是否可以在当前模块中创建记录。
"generated_type":描述用户将生成的模块类型。有4种类型:默认、web、自定义和链接。
"api_supported":当前API无法访问的模块值为“false”。如果将来支持这些模块,该值将自动更改为“true”。
"modified_time":用户进行更改的日期和时间。
访问资源时,引用JSON数据中的键api_name。每个模块、字段和相关列表都有一个API名称,可以在第三方集成中使用。例如,如果您想访问Leads模块,那么在每次访问资源时使用“Leads”作为api_name。Zoho CRM在创建自定义模块、自定义字段或相关列表标签时,在内部生成API名称。请注意,您不能更改默认模块、字段和相关列表的API名称。您只能为自定义模块、字段和相关列表更改API名称。
生成的API名称只能包含字母、数字和下划线。API名称应该以字母开头,不应该有两个连续的下划线或以下划线结尾。
参考响应结构了解有关JSON键、值及其对可用模块的描述的详细信息。您还可以使用每个模块的示例响应作为输入,在相应模块中插入、更新或维护记录。
示例请求
curl "https://www.zohoapis.com.cn/crm/v2/settings/modules"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.03xxxxxxxxxxxxxxxxxa5317.dxxxxxxxxxxxxxxxxxfa"
示例响应
{
"modules": [
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Feeds",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Feeds",
"api_name": "Feeds",
"modified_by": null,
"generated_type": "default",
"id": "410888000000059001",
"module_name": "Feeds"
},
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Home",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Home",
"api_name": "Home",
"modified_by": null,
"generated_type": "default",
"id": "410888000000000123",
"module_name": "Home"
},
{
"convertable": true,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Lead",
"modified_time": "2016-07-29T13:19:14+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Leads",
"api_name": "Leads",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000125",
"module_name": "Leads"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Account",
"modified_time": "2016-06-27T15:15:13+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Accounts",
"api_name": "Accounts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000127",
"module_name": "Accounts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Contact",
"modified_time": "2016-04-29T12:45:09+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Contacts",
"api_name": "Contacts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000129",
"module_name": "Contacts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Potential",
"modified_time": "2016-04-22T16:22:32+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Potentials",
"api_name": "Potentials",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000131",
"module_name": "Potentials"
}
]
}
示例请求
ZCRMRestClient client = ZCRMRestClient.getInstance();
BulkAPIResponse response = client.getAllModules();
List<ZCRMModule> modules = (List<ZCRMModule>) response.getData();
示例响应
{
"modules": [
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Feeds",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Feeds",
"api_name": "Feeds",
"modified_by": null,
"generated_type": "default",
"id": "410888000000059001",
"module_name": "Feeds"
},
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Home",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Home",
"api_name": "Home",
"modified_by": null,
"generated_type": "default",
"id": "410888000000000123",
"module_name": "Home"
},
{
"convertable": true,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Lead",
"modified_time": "2016-07-29T13:19:14+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Leads",
"api_name": "Leads",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000125",
"module_name": "Leads"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Account",
"modified_time": "2016-06-27T15:15:13+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Accounts",
"api_name": "Accounts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000127",
"module_name": "Accounts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Contact",
"modified_time": "2016-04-29T12:45:09+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Contacts",
"api_name": "Contacts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000129",
"module_name": "Contacts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Potential",
"modified_time": "2016-04-22T16:22:32+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Potentials",
"api_name": "Potentials",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000131",
"module_name": "Potentials"
}
]
}
示例请求
def get_modules(self):
try:
resp=ZCRMRestClient.get_instance().get_all_modules()
modules=resp.data
print resp.status_code
for module in modules:
print "\n\n::MODULE::"
print module.api_name
print module.is_convertable
print module.is_creatable
print module.is_editable
print module.is_deletable
print module.web_link
print module.singular_label
print module.plural_label
print module.modified_by
print module.modified_time
print module.is_viewable
print module.is_api_supported
print module.is_custom_module
print module.is_scoring_supported
print module.id
print module.module_name
print module.business_card_field_limit
print module.business_card_fields
profiles= module.profiles
if profiles is not None:
for profile inprofiles:
print profile.name
print profile.id
print module.display_field_name
print module.display_field_id
if module.related_lists is not None:
for relatedlist in module.related_lists:
print relatedlist.display_label
print relatedlist.is_visible
print relatedlist.api_name
print relatedlist.module
print relatedlist.name
print relatedlist.id
print relatedlist.href
print relatedlist.type
if module.layouts is not None:
for layout in module.layouts:
self.print_layout(layout)
if module.fields is not None:
for field_ins in module.fields:
self.print_filed(field_ins)
if module.related_list_properties is not None:
print module.related_list_properties.sort_by
print module.related_list_properties.sort_order
print module.related_list_properties.fields
print module.properties
print module.per_page
print module.search_layout_fields
print module.default_territory_name
print module.default_territory_id
print module.default_custom_view_id
print module.default_custom_view
print module.is_global_search_supported
print module.sequence_number
except ZCRMException as ex:
print ex.status_code
print ex.error_message
print ex.error_code
print ex.error_details
print ex.error_content
示例响应
{
"modules": [
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Feeds",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Feeds",
"api_name": "Feeds",
"modified_by": null,
"generated_type": "default",
"id": "410888000000059001",
"module_name": "Feeds"
},
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Home",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Home",
"api_name": "Home",
"modified_by": null,
"generated_type": "default",
"id": "410888000000000123",
"module_name": "Home"
},
{
"convertable": true,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Lead",
"modified_time": "2016-07-29T13:19:14+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Leads",
"api_name": "Leads",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000125",
"module_name": "Leads"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Account",
"modified_time": "2016-06-27T15:15:13+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Accounts",
"api_name": "Accounts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000127",
"module_name": "Accounts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Contact",
"modified_time": "2016-04-29T12:45:09+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Contacts",
"api_name": "Contacts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000129",
"module_name": "Contacts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Potential",
"modified_time": "2016-04-22T16:22:32+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Potentials",
"api_name": "Potentials",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000131",
"module_name": "Potentials"
}
]
}
示例请求
try{
$ins=ZCRMRestClient::getInstance();
$moduleArr=$ins->getAllModules()->getData();
foreach ($moduleArr as $module)
{
echo "ModuleName:".$module->getModuleName();
echo "SingLabel:".$module->getSingularLabel();
echo "PluLabel:".$module->getPluralLabel();
echo "BusinesscardLimit:".$module->getBusinessCardFieldLimit();
echo "ApiName:".$module->getAPIName();
$fields=$module->getFields();
if($fields==null)
{
continue;
}
foreach ($fields as $field)
{
echo $field->getApiName().", ";
echo $field->getLength().", ";
echo $field->IsVisible().", ";
echo $field->getFieldLabel().", ";
echo $field->getCreatedSource().", ";
echo $field->isMandatory().", ";
echo $field->getSequenceNumber().", ";
echo $field->isReadOnly().", ";
echo $field->getDataType().", ";
echo $field->getId().", ";
echo $field->isCustomField().", ";
echo $field->isBusinessCardSupported().", ";
echo $field->getDefaultValue().", ";
}
}
}
catch (ZCRMException $e)
{
echo $e->getCode();
echo $e->getMessage();
echo $e->getExceptionCode();
}
示例响应
{
"modules": [
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Feeds",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Feeds",
"api_name": "Feeds",
"modified_by": null,
"generated_type": "default",
"id": "410888000000059001",
"module_name": "Feeds"
},
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Home",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Home",
"api_name": "Home",
"modified_by": null,
"generated_type": "default",
"id": "410888000000000123",
"module_name": "Home"
},
{
"convertable": true,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Lead",
"modified_time": "2016-07-29T13:19:14+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Leads",
"api_name": "Leads",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000125",
"module_name": "Leads"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Account",
"modified_time": "2016-06-27T15:15:13+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Accounts",
"api_name": "Accounts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000127",
"module_name": "Accounts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Contact",
"modified_time": "2016-04-29T12:45:09+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Contacts",
"api_name": "Contacts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000129",
"module_name": "Contacts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Potential",
"modified_time": "2016-04-22T16:22:32+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Potentials",
"api_name": "Potentials",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000131",
"module_name": "Potentials"
}
]
}
示例请求
ZCRMRestClient restClient = ZCRMRestClient.GetInstance();
BulkAPIResponse<ZCRMModule> response = restClient.GetAllModules();
List<ZCRMModule> modules = response.BulkData; // modules - ZCRMModule实例列表
示例响应
{
"modules": [
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Feeds",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Feeds",
"api_name": "Feeds",
"modified_by": null,
"generated_type": "default",
"id": "410888000000059001",
"module_name": "Feeds"
},
{
"convertable": false,
"editable": false,
"deletable": false,
"web_link": null,
"singular_label": "Home",
"modified_time": null,
"viewable": true,
"api_supported": false,
"createable": false,
"plural_label": "Home",
"api_name": "Home",
"modified_by": null,
"generated_type": "default",
"id": "410888000000000123",
"module_name": "Home"
},
{
"convertable": true,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Lead",
"modified_time": "2016-07-29T13:19:14+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Leads",
"api_name": "Leads",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000125",
"module_name": "Leads"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Account",
"modified_time": "2016-06-27T15:15:13+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Accounts",
"api_name": "Accounts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000127",
"module_name": "Accounts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Contact",
"modified_time": "2016-04-29T12:45:09+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Contacts",
"api_name": "Contacts",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000129",
"module_name": "Contacts"
},
{
"convertable": false,
"editable": true,
"deletable": true,
"web_link": null,
"singular_label": "Potential",
"modified_time": "2016-04-22T16:22:32+05:30",
"viewable": true,
"api_supported": true,
"createable": true,
"plural_label": "Potentials",
"api_name": "Potentials",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"generated_type": "default",
"id": "410888000000000131",
"module_name": "Potentials"
}
]
}