Zoho CRM
Zoho CRM
通过托管式OAuth认证访问Zoho CRM API。管理线索、联系人、客户、交易及其他CRM模块,支持完整的增删改查操作,包括搜索和批量操作。还支持获取组织详情、用户管理以及模块元数据检索。
快速开始
# 列出线索
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads?fields=First_Name,Last_Name,Email')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
基础URL
https://gateway.maton.ai/zoho-crm/crm/v8/{端点}
网关将请求代理至www.zohoapis.com/crm/v8并自动注入您的OAuth令牌。
认证
所有请求都要求在Authorization请求头中包含Maton API密钥:
Authorization: Bearer $MATON_API_KEY
环境变量:将您的API密钥设置为MATON_API_KEY:
export MATON_API_KEY="您的API密钥"
获取您的API密钥
- 登录或注册账户,请访问maton.ai
- 前往maton.ai/settings
- 复制您的 API 密钥
连接管理
在以下地址管理您的 Zoho CRM OAuth 连接https://ctrl.maton.ai。
列出连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=zoho-crm&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
创建连接
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'zoho-crm'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
获取连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"connection": {
"connection_id": "e55c5bac-241a-4cc8-9db5-50d2cad09136",
"status": "ACTIVE",
"creation_time": "2025-12-08T07:20:53.488460Z",
"last_updated_time": "2026-01-31T20:03:32.593153Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "zoho-crm",
"metadata": {}
}
}
在浏览器中打开返回的url以完成 OAuth 授权。
删除连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
指定连接
如果您有多个 Zoho CRM 连接,请使用以下方式指定要使用哪一个:Maton-连接请求头:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads?fields=First_Name,Last_Name,Email')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', 'e55c5bac-241a-4cc8-9db5-50d2cad09136')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略此参数,网关将使用默认(最早创建的)活动连接。
API 参考
模块
Zoho CRM 将数据组织到模块中。核心模块包括:
| 模块 | API 名称 | 描述 |
|---|---|---|
| 线索 | Leads | 潜在客户 |
| 联系人 | Contacts | 个人 |
| 客户 | Accounts | 组织/公司 |
| 交易 | Deals | 销售机会 |
| 营销活动 | Campaigns | 营销活动 |
| 任务 | Tasks | 待办事项 |
| 通话 | Calls | 电话通话记录 |
| 事件 | Events | 日历预约 |
| 产品 | Products | 您销售的商品 |
列出记录
GET /zoho-crm/crm/v8/{模块API名称}?fields={字段1},{字段2}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
字段 | 字符串 | 必需。逗号分隔的字段API名称(最多50个) |
页码 | 整数 | 页码(默认值:1) |
每页记录数 | 整数 | 每页记录数(默认值/最大值:200) |
排序依据 | 字符串 | 排序依据:ID、创建时间或修改时间 |
排序顺序 | 字符串 | 升序或降序(默认) |
自定义视图ID | 长整型 | 自定义视图ID |
分页令牌 | 字符串 | 用于超过2000条记录的分页 |
示例 - 列出潜在客户:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads?fields=First_Name,Last_Name,Email,Phone,Company')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"data": [
{
"First_Name": "Christopher",
"Email": "christopher-maclead@noemail.invalid",
"Last_Name": "Maclead (Sample)",
"Phone": "555-555-5555",
"Company": "Rangoni Of Florence",
"id": "7243485000000597000"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"sort_by": "id",
"sort_order": "desc",
"more_records": false,
"next_page_token": null
}
}
示例 - 列出联系人:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Contacts?fields=First_Name,Last_Name,Email,Phone')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
示例 - 列出客户:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Accounts?fields=Account_Name,Website,Phone')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
示例 - 列出交易:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Deals?fields=Deal_Name,Stage,Amount')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
获取记录
GET /zoho-crm/crm/v8/{module_api_name}/{record_id}
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads/7243485000000597000')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
创建记录
POST /zoho-crm/crm/v8/{module_api_name}
Content-Type: application/json
{
"data": [
{
"field_api_name": "value"
}
]
}
各模块的必填字段:
| 模块 | 必填字段 |
|---|---|
| 线索 | 姓氏 |
| 联系人 | 姓氏 |
| 客户 | 客户名称 |
| 商机 | 商机名称,阶段 |
| 任务 | 主题 |
| 通话 | 主题,通话类型,通话开始时间,通话时长 |
| 事件 | 事件标题,开始日期时间,结束日期时间 |
示例 - 创建潜在客户:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"Last_Name": "Smith",
"First_Name": "John",
"Email": "john.smith@example.com",
"Company": "Acme Corp",
"Phone": "+1-555-0123"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2026-02-06T01:10:56-08:00",
"Modified_By": {
"name": "User Name",
"id": "7243485000000590001"
},
"Created_Time": "2026-02-06T01:10:56-08:00",
"id": "7243485000000619001",
"Created_By": {
"name": "User Name",
"id": "7243485000000590001"
}
},
"message": "record added",
"status": "success"
}
]
}
示例 - 创建联系人:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"Last_Name": "Doe",
"First_Name": "Jane",
"Email": "jane.doe@example.com",
"Phone": "+1-555-9876"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Contacts', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
示例 - 创建客户:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"Account_Name": "Acme Corporation",
"Website": "https://acme.com",
"Phone": "+1-555-1234"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Accounts', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
更新记录
PUT /zoho-crm/crm/v8/{模块API名称}
Content-Type: application/json
{
"data": [
{
"id": "记录ID",
"字段API名称": "更新值"
}
]
}
示例:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"id": "7243485000000619001",
"Phone": "+1-555-9999",
"Company": "更新的公司名称"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads', data=data, method='PUT')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2026-02-06T01:11:01-08:00",
"Modified_By": {
"name": "用户名",
"id": "7243485000000590001"
},
"Created_Time": "2026-02-06T01:10:56-08:00",
"id": "7243485000000619001",
"Created_By": {
"name": "用户名",
"id": "7243485000000590001"
}
},
"message": "记录已更新",
"status": "success"
}
]
}
删除记录
DELETE /zoho-crm/crm/v8/{模块API名称}?ids={记录ID1},{记录ID2}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
ids | 字符串 | 逗号分隔的记录ID(必需,最多100个) |
wf_trigger | 布尔值 | 执行工作流(默认值:true) |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads?ids=7243485000000619001', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"data": [
{
"code": "SUCCESS",
"details": {
"id": "7243485000000619001"
},
"message": "记录已删除",
"status": "success"
}
]
}
搜索记录
GET /zoho-crm/crm/v8/{模块API名称}/搜索
查询参数(必填其一):
| 参数 | 类型 | 描述 |
|---|---|---|
criteria | 字符串 | 搜索条件(例如:(Last_Name:等于:Smith)) |
email | 字符串 | 按电子邮件地址搜索 |
phone | 字符串 | 按电话号码搜索 |
word | 字符串 | 全局文本搜索 |
page | 整数 | 页码 |
per_page | 整数 | 每页记录数(最多200条) |
条件格式: ((字段API名称:运算符:值) 和/或 (...))
运算符:
- 文本字段:
等于,不等于,以...开头,包含在...中 - 日期/数字字段:
等于,不等于,大于,小于,在,布尔字段中: - 等于
,不等于示例 - 通过电子邮件搜索:
python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/Leads/search?email=christopher-maclead@noemail.invalid') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF
示例 - 通过条件搜索:
python <<'EOF' import urllib.request, os, json import urllib.parse criteria = urllib.parse.quote('(Last_Name:starts_with:Smith)') req = urllib.request.Request(f'https://gateway.maton.ai/zoho-crm/crm/v8/Leads/search?criteria={criteria}') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF
响应:
{ "data": [ { "First_Name": "Christopher", "Email": "christopher-maclead@noemail.invalid", "Last_Name": "Maclead (Sample)", "id": "7243485000000597000" } ], "info": { "per_page": 200, "count": 1, "page": 1, "more_records": false } }
组织详情
检索您的 Zoho CRM 组织详情。
GET /zoho-crm/crm/v8/org
示例:
python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/org') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF
响应:
{ "org": [ { "id": "7243485000000020005", "company_name": "Acme Corp", "domain_name": "org123456789", "primary_email": "admin@example.com", "phone": "555-555-5555", "currency": "US Dollar - USD", "currency_symbol": "$", "iso_code": "USD", "time_zone": "PST", "country_code": "US", "zgid": "123456789", "type": "production", "mc_status": false, "license_details": { "paid": true, "paid_type": "enterprise", "users_license_purchased": 10, "trial_expiry": null } } ] }
用户
检索您 Zoho CRM 组织中的用户。
GET /zoho-crm/crm/v8/users
GET /zoho-crm/crm/v8/users
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
类型 | 字符串 | 按用户类型筛选:所有用户、活跃用户、非活跃用户、已验证用户、未验证用户、已删除用户、活跃已验证用户、管理员用户活跃已确认管理员当前用户页码整数 |
页码(默认值:1) | 每页记录数 | 整数 |
每页记录数(默认值/最大值:200) | ID列表 | 字符串 |
逗号分隔的用户ID(最多100个) | 示例 - 列出所有用户: | python <<'EOF' import urllib.request, os, json req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/users?type=AllUsers') req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}') print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2)) EOF |
响应:
{
"users": [
{
"id": "7243485000000590001",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"email": "john.doe@example.com",
"status": "active",
"confirm": true,
"role": {
"name": "CEO",
"id": "7243485000000026005"
},
"profile": {
"name": "Administrator",
"id": "7243485000000026011"
},
"time_zone": "PST",
"country": "US",
"locale": "en_US"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}
示例 - 获取特定用户:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/users/7243485000000590001')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
模块元数据
检索所有可用CRM模块的元数据。
GET /zoho-crm/crm/v8/settings/modules
查询参数:
GET /zoho-crm/crm/v8/settings/modules
Query Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
状态 | 字符串 | 按状态筛选:user_hidden、system_hidden、scheduled_for_deletion、visible |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/modules')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"modules": [
{
"api_name": "Leads",
"module_name": "Leads",
"singular_label": "Lead",
"plural_label": "Leads",
"api_supported": true,
"creatable": true,
"editable": true,
"deletable": true,
"viewable": true,
"status": "visible",
"generated_type": "default",
"id": "7243485000000002175",
"profiles": [
{"name": "Administrator", "id": "7243485000000026011"}
]
}
]
}
字段元数据
检索特定模块的字段元数据。
GET /zoho-crm/crm/v8/settings/fields?module={module_api_name}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
模块 | 字符串 | 必需。模块的 API 名称(例如:Leads、Contacts) |
类型 | 字符串 | all表示所有字段,unused表示仅未使用的字段 |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/fields?module=Leads')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"fields": [
{
"api_name": "Last_Name",
"field_label": "Last Name",
"data_type": "text",
"system_mandatory": true,
"custom_field": false,
"visible": true,
"searchable": true,
"sortable": true,
"id": "7243485000000002613"
}
]
}
布局元数据
检索特定模块的布局元数据。
GET /zoho-crm/crm/v8/settings/layouts?module={module_api_name}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
module | 字符串 | 必填。模块的API名称(例如,Leads、Contacts) |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/layouts?module=Leads')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"layouts": [
{
"id": "7243485000000091055",
"name": "标准",
"api_name": "Standard",
"status": "active",
"visible": true,
"profiles": [
{"name": "管理员", "id": "7243485000000026011"}
],
"sections": [
{
"display_label": "潜在客户信息",
"api_name": "Lead_Information",
"sequence_number": 1,
"fields": [...]
}
]
}
]
}
角色
获取您Zoho CRM组织中的角色。
GET /zoho-crm/crm/v8/settings/roles
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/roles')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"roles": [
{
"id": "7243485000000026005",
"name": "CEO",
"display_label": "CEO",
"share_with_peers": true,
"description": null,
"reporting_to": null
},
{
"id": "7243485000000026008",
"name": "Manager",
"display_label": "Manager",
"share_with_peers": false,
"reporting_to": {
"name": "CEO",
"id": "7243485000000026005"
}
}
]
}
示例 - 获取特定角色:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/roles/7243485000000026005')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
配置文件
获取您Zoho CRM组织中的配置文件(权限集)。
GET /zoho-crm/crm/v8/settings/profiles
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/profiles')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
{
"profiles": [
{
"id": "7243485000000026011",
"name": "Administrator",
"display_label": "Administrator",
"type": "normal_profile",
"custom": false,
"description": null
},
{
"id": "7243485000000026014",
"name": "Standard",
"display_label": "Standard",
"type": "normal_profile",
"custom": false,
"description": null
}
]
}
示例 - 获取特定配置文件:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-crm/crm/v8/settings/profiles/7243485000000026011')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
分页
Zoho CRM 使用基于页面的分页机制,对于大型数据集可选择使用页面令牌:
GET /zoho-crm/crm/v8/{模块API名称}?fields=First_Name,Last_Name&page=1&per_page=50
响应包含分页信息:
{
"data": [...],
"info": {
"per_page": 50,
"count": 50,
"page": 1,
"sort_by": "id",
"sort_order": "desc",
"more_records": true,
"next_page_token": "token_value",
"page_token_expiry": "2026-02-07T01:10:56-08:00"
}
}
- 对于最多 2,000 条记录:使用
page参数(每次请求递增) - 对于超过 2,000 条记录:使用
page_token(来自前一个响应) - 页面令牌在 24 小时后过期
代码示例
JavaScript
const response = await fetch(
'https://gateway.maton.ai/zoho-crm/crm/v8/Leads?fields=First_Name,Last_Name,Email',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
Python
import os
import requests
response = requests.get(
'https://gateway.maton.ai/zoho-crm/crm/v8/Leads',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
params={'fields': 'First_Name,Last_Name,Email'}
)
data = response.json()
注意事项
- 对于列表操作,
fields参数是必需的(最多 50 个字段) - 模块 API 名称区分大小写(例如,
Leads,而不是leads) - 每个创建/更新请求最多 100 条记录
- 每个删除请求最多 100 条记录
- 每个 GET 请求最多返回 200 条记录
- 不使用 page_token 时最多 2,000 条记录;使用 page_token 时最多 100,000 条记录
- 在请求中使用字段的 API 名称(而非显示名称)
- 如果您收到范围错误,请联系 Maton 技术支持,邮箱:support@maton.ai以及您需要的具体操作/API和您的使用场景
- 空数据集返回HTTP状态码204(无内容)且响应体为空
- 重要提示:使用curl命令时,如果URL中包含方括号,请使用
curl -g以禁用通配符解析 - 重要提示:当将curl输出通过管道传递给
jq或其他命令时,在某些shell环境中,像$MATON_API_KEY这样的环境变量可能无法正确展开
错误处理
| 状态码 | 含义 |
|---|---|
| 400 | 缺少Zoho CRM连接、缺少必要参数或请求无效 |
| 401 | Maton API密钥无效或缺失,或OAuth范围不匹配 |
| 404 | 未找到资源 |
| 429 | 请求频率受限 |
| 4xx/5xx | 来自Zoho CRM API的透传错误 |
常见错误代码
| 代码 | 描述 |
|---|---|
OAUTH_SCOPE_MISMATCH | OAuth令牌缺少该端点所需的权限 |
MANDATORY_NOT_FOUND | 缺少必填字段 |
INVALID_DATA | 数据类型不匹配或格式错误 |
DUPLICATE_DATA | 记录违反唯一字段约束 |
记录未找到 | 指定的记录ID不存在 |
故障排除:API密钥问题
- 检查
MATON_API_KEY环境变量是否已设置:
echo $MATON_API_KEY
- 通过列出连接来验证API密钥是否有效:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
故障排除:无效的应用名称
- 确保您的URL路径以
zoho-crm开头。例如:
- 正确:
https://gateway.maton.ai/zoho-crm/crm/v8/Leads - 错误:
https://gateway.maton.ai/crm/v8/Leads


微信扫一扫,打赏作者吧~