元数据API
返回指定模块的字段、布局和相关列表的元数据。它列出了该模块的所有可用字段和相关列表。
模块元数据
目的
获取特定模块的元数据。指定模块的API名称,例如API请求中的线索、客户或商机。
请求URL
https://www.zohoapis.com.cn/crm/v2/settings/modules/{module_api_name}
module_api_name - 模块的API名称
请求方法
GET
范围
scope=ZohoCRM.settings.modules.read
(或)
scope=ZohoCRM.settings.modules.all
(或)
scope=ZohoCRM.settings.all
可能的错误
HTTP状态 | 错误码 | 消息 | 原因 |
---|---|---|---|
400 | INVALID_MODULE | The module name given seems to be invalid | 无效的模块名称或没有模块权限,或者模块可能已从机构的模块中删除 |
400 | INVALID_MODULE | The given module is not supported in API | 当前API不支持文档和项目等模块。(一旦支持了这些模块,就不会显示此错误。) |
示例请求
curl "https://www.zohoapis.com.cn/crm/v2/settings/modules/Leads"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
示例响应
{
"modules": [
{
"global_search_supported": true,
"kanban_view": false,
"deletable": true,
"creatable": true,
"filter_status": true,
"modified_time": "2019-02-05T11:33:03+05:30",
"plural_label": "Leads",
"presence_sub_menu": true,
"id": "3652397000000002175",
"related_list_properties": {
"sort_by": null,
"fields": [
"First_Name",
"Last_Name",
"Full_Name",
"Company",
"Email",
"Lead_Source",
"Lead_Status",
"Phone"
],
"sort_order": null
},
"$properties": [
"$converted",
"$approved",
"$converted_detail",
"$currency_symbol",
"$approval",
"$process_flow"
],
"per_page": 10,
"visibility": 1,
"convertable": true,
"editable": true,
"emailTemplate_support": true,
"profiles": [
{
"name": "Administrator",
"id": "3652397000000026011"
},
{
"name": "Standard",
"id": "3652397000000026014"
}
],
"filter_supported": true,
"display_field": "Full_Name",
"search_layout_fields": [
"Owner",
"Company",
"Email",
"Phone",
"Lead_Source",
"Full_Name"
],
"kanban_view_supported": true,
"web_link": null,
"sequence_number": 2,
"singular_label": "Lead",
"viewable": true,
"api_supported": true,
"api_name": "Leads",
"quick_create": true,
"modified_by": {
"name": "Patricia Boyle",
"id": "3652397000000186017"
},
"generated_type": "default",
"feeds_required": false,
"scoring_supported": true,
"arguments": [],
"module_name": "Leads",
"business_card_field_limit": 5,
"custom_view": {
"display_value": "All Leads",
"shared_type": null,
"criteria": {
"comparator": "equal",
"field": "$converted",
"value": false
},
"system_name": "ALLVIEWS",
"shared_details": null,
"sort_by": null,
"offline": true,
"default": true,
"system_defined": true,
"name": "All Open Leads",
"id": "3652397000000087501",
"category": "shared_with_me",
"fields": [
"Full_Name",
"Company",
"Email",
"Phone",
"Lead_Source",
"Owner",
"Prediction_Score"
],
"favorite": null,
"sort_order": null
},
"parent_module": {}
}
]
}
示例请求
ZCRMRestClient client = ZCRMRestClient.getInstance();
APIResponse response = client.getModule("Products");//模块API名称
ZCRMModule module = (ZCRMModule) response.getData();
示例响应
{
"modules": [
{
"global_search_supported": true,
"kanban_view": false,
"deletable": true,
"creatable": true,
"filter_status": true,
"modified_time": "2019-02-05T11:33:03+05:30",
"plural_label": "Leads",
"presence_sub_menu": true,
"id": "3652397000000002175",
"related_list_properties": {
"sort_by": null,
"fields": [
"First_Name",
"Last_Name",
"Full_Name",
"Company",
"Email",
"Lead_Source",
"Lead_Status",
"Phone"
],
"sort_order": null
},
"$properties": [
"$converted",
"$approved",
"$converted_detail",
"$currency_symbol",
"$approval",
"$process_flow"
],
"per_page": 10,
"visibility": 1,
"convertable": true,
"editable": true,
"emailTemplate_support": true,
"profiles": [
{
"name": "Administrator",
"id": "3652397000000026011"
},
{
"name": "Standard",
"id": "3652397000000026014"
}
],
"filter_supported": true,
"display_field": "Full_Name",
"search_layout_fields": [
"Owner",
"Company",
"Email",
"Phone",
"Lead_Source",
"Full_Name"
],
"kanban_view_supported": true,
"web_link": null,
"sequence_number": 2,
"singular_label": "Lead",
"viewable": true,
"api_supported": true,
"api_name": "Leads",
"quick_create": true,
"modified_by": {
"name": "Patricia Boyle",
"id": "3652397000000186017"
},
"generated_type": "default",
"feeds_required": false,
"scoring_supported": true,
"arguments": [],
"module_name": "Leads",
"business_card_field_limit": 5,
"custom_view": {
"display_value": "All Leads",
"shared_type": null,
"criteria": {
"comparator": "equal",
"field": "$converted",
"value": false
},
"system_name": "ALLVIEWS",
"shared_details": null,
"sort_by": null,
"offline": true,
"default": true,
"system_defined": true,
"name": "All Open Leads",
"id": "3652397000000087501",
"category": "shared_with_me",
"fields": [
"Full_Name",
"Company",
"Email",
"Phone",
"Lead_Source",
"Owner",
"Prediction_Score"
],
"favorite": null,
"sort_order": null
},
"parent_module": {}
}
]
}
示例请求
try{
$ins=ZCRMRestClient::getInstance();
$apiResponse=$ins->getModule("Leads");//模块API名称
$module=$apiResponse->getData();
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": [
{
"global_search_supported": true,
"kanban_view": false,
"deletable": true,
"creatable": true,
"filter_status": true,
"modified_time": "2019-02-05T11:33:03+05:30",
"plural_label": "Leads",
"presence_sub_menu": true,
"id": "3652397000000002175",
"related_list_properties": {
"sort_by": null,
"fields": [
"First_Name",
"Last_Name",
"Full_Name",
"Company",
"Email",
"Lead_Source",
"Lead_Status",
"Phone"
],
"sort_order": null
},
"$properties": [
"$converted",
"$approved",
"$converted_detail",
"$currency_symbol",
"$approval",
"$process_flow"
],
"per_page": 10,
"visibility": 1,
"convertable": true,
"editable": true,
"emailTemplate_support": true,
"profiles": [
{
"name": "Administrator",
"id": "3652397000000026011"
},
{
"name": "Standard",
"id": "3652397000000026014"
}
],
"filter_supported": true,
"display_field": "Full_Name",
"search_layout_fields": [
"Owner",
"Company",
"Email",
"Phone",
"Lead_Source",
"Full_Name"
],
"kanban_view_supported": true,
"web_link": null,
"sequence_number": 2,
"singular_label": "Lead",
"viewable": true,
"api_supported": true,
"api_name": "Leads",
"quick_create": true,
"modified_by": {
"name": "Patricia Boyle",
"id": "3652397000000186017"
},
"generated_type": "default",
"feeds_required": false,
"scoring_supported": true,
"arguments": [],
"module_name": "Leads",
"business_card_field_limit": 5,
"custom_view": {
"display_value": "All Leads",
"shared_type": null,
"criteria": {
"comparator": "equal",
"field": "$converted",
"value": false
},
"system_name": "ALLVIEWS",
"shared_details": null,
"sort_by": null,
"offline": true,
"default": true,
"system_defined": true,
"name": "All Open Leads",
"id": "3652397000000087501",
"category": "shared_with_me",
"fields": [
"Full_Name",
"Company",
"Email",
"Phone",
"Lead_Source",
"Owner",
"Prediction_Score"
],
"favorite": null,
"sort_order": null
},
"parent_module": {}
}
]
}
示例请求
try:
resp=ZCRMRestClient.get_instance().get_module('Accounts') #module API Name
modules=[resp.data]
print resp.status_code
for module in modules:
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 in profiles:
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_field(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": [
{
"global_search_supported": true,
"kanban_view": false,
"deletable": true,
"creatable": true,
"filter_status": true,
"modified_time": "2019-02-05T11:33:03+05:30",
"plural_label": "Leads",
"presence_sub_menu": true,
"id": "3652397000000002175",
"related_list_properties": {
"sort_by": null,
"fields": [
"First_Name",
"Last_Name",
"Full_Name",
"Company",
"Email",
"Lead_Source",
"Lead_Status",
"Phone"
],
"sort_order": null
},
"$properties": [
"$converted",
"$approved",
"$converted_detail",
"$currency_symbol",
"$approval",
"$process_flow"
],
"per_page": 10,
"visibility": 1,
"convertable": true,
"editable": true,
"emailTemplate_support": true,
"profiles": [
{
"name": "Administrator",
"id": "3652397000000026011"
},
{
"name": "Standard",
"id": "3652397000000026014"
}
],
"filter_supported": true,
"display_field": "Full_Name",
"search_layout_fields": [
"Owner",
"Company",
"Email",
"Phone",
"Lead_Source",
"Full_Name"
],
"kanban_view_supported": true,
"web_link": null,
"sequence_number": 2,
"singular_label": "Lead",
"viewable": true,
"api_supported": true,
"api_name": "Leads",
"quick_create": true,
"modified_by": {
"name": "Patricia Boyle",
"id": "3652397000000186017"
},
"generated_type": "default",
"feeds_required": false,
"scoring_supported": true,
"arguments": [],
"module_name": "Leads",
"business_card_field_limit": 5,
"custom_view": {
"display_value": "All Leads",
"shared_type": null,
"criteria": {
"comparator": "equal",
"field": "$converted",
"value": false
},
"system_name": "ALLVIEWS",
"shared_details": null,
"sort_by": null,
"offline": true,
"default": true,
"system_defined": true,
"name": "All Open Leads",
"id": "3652397000000087501",
"category": "shared_with_me",
"fields": [
"Full_Name",
"Company",
"Email",
"Phone",
"Lead_Source",
"Owner",
"Prediction_Score"
],
"favorite": null,
"sort_order": null
},
"parent_module": {}
}
]
}
示例请求
ZCRMRestClient restClient = ZCRMRestClient.GetInstance();
APIResponse response = restClient.GetModule("Leads"); //模块API名称
ZCRMModule module = (ZCRMModule)response.Data;
示例响应
{
"modules": [
{
"global_search_supported": true,
"kanban_view": false,
"deletable": true,
"creatable": true,
"filter_status": true,
"modified_time": "2019-02-05T11:33:03+05:30",
"plural_label": "Leads",
"presence_sub_menu": true,
"id": "3652397000000002175",
"related_list_properties": {
"sort_by": null,
"fields": [
"First_Name",
"Last_Name",
"Full_Name",
"Company",
"Email",
"Lead_Source",
"Lead_Status",
"Phone"
],
"sort_order": null
},
"$properties": [
"$converted",
"$approved",
"$converted_detail",
"$currency_symbol",
"$approval",
"$process_flow"
],
"per_page": 10,
"visibility": 1,
"convertable": true,
"editable": true,
"emailTemplate_support": true,
"profiles": [
{
"name": "Administrator",
"id": "3652397000000026011"
},
{
"name": "Standard",
"id": "3652397000000026014"
}
],
"filter_supported": true,
"display_field": "Full_Name",
"search_layout_fields": [
"Owner",
"Company",
"Email",
"Phone",
"Lead_Source",
"Full_Name"
],
"kanban_view_supported": true,
"web_link": null,
"sequence_number": 2,
"singular_label": "Lead",
"viewable": true,
"api_supported": true,
"api_name": "Leads",
"quick_create": true,
"modified_by": {
"name": "Patricia Boyle",
"id": "3652397000000186017"
},
"generated_type": "default",
"feeds_required": false,
"scoring_supported": true,
"arguments": [],
"module_name": "Leads",
"business_card_field_limit": 5,
"custom_view": {
"display_value": "All Leads",
"shared_type": null,
"criteria": {
"comparator": "equal",
"field": "$converted",
"value": false
},
"system_name": "ALLVIEWS",
"shared_details": null,
"sort_by": null,
"offline": true,
"default": true,
"system_defined": true,
"name": "All Open Leads",
"id": "3652397000000087501",
"category": "shared_with_me",
"fields": [
"Full_Name",
"Company",
"Email",
"Phone",
"Lead_Source",
"Owner",
"Prediction_Score"
],
"favorite": null,
"sort_order": null
},
"parent_module": {}
}
]
}