Zoho Bigin
2026-03-25
新闻来源:网淘吧
围观:55
电脑广告
手机广告
Zoho Bigin
通过托管的OAuth认证访问Zoho Bigin API。对联系人、公司、销售管道和产品执行完整的增删改查操作。
快速入门
# 列出联系人
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts?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-bigin/bigin/v2/{端点}
网关将请求代理至www.zohoapis.com/bigin/v2并自动注入您的OAuth令牌。
认证
所有请求均需在Authorization请求头中包含Maton API密钥:
Authorization: Bearer $MATON_API_KEY
环境变量:将您的API密钥设置为MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
获取您的API密钥
- 登录或注册账户,请访问maton.ai
- 前往maton.ai/settings
- 复制您的API密钥
连接管理
在以下地址管理您的 Zoho Bigin OAuth 连接https://ctrl.maton.ai。
列出连接
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=zoho-bigin&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-bigin'}).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": "21fd90f9-5935-43cd-b6c8-bde9d915ca80",
"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-bigin",
"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 Bigin 连接,请使用Maton-Connection请求头来指定要使用哪一个:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts?fields=First_Name,Last_Name,Email')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', '21fd90f9-5935-43cd-b6c8-bde9d915ca80')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最早创建的)活跃连接。
API 参考
模块
Zoho Bigin 将数据组织到不同的模块中。可用的模块包括:
| 模块 | API 名称 | 描述 |
|---|---|---|
| 联系人 | Contacts | 个人 |
| 公司 | Accounts | 组织/企业 |
| 销售管道 | Pipelines | 销售机会/交易 |
| 产品 | 产品 | 您销售的商品 |
| 任务 | 任务 | 待办事项(需要额外的OAuth权限范围) |
| 事件 | 事件 | 日历预约(需要额外的OAuth权限范围) |
| 通话 | 通话 | 电话通话记录(需要额外的OAuth权限范围) |
| 备注 | 备注 | 附加到记录的备注(需要额外的OAuth权限范围) |
列出记录
GET /zoho-bigin/bigin/v2/{module_api_name}?fields={field1},{field2}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
字段 | 字符串 | 必需。要检索的字段 API 名称,以逗号分隔 |
排序顺序 | 字符串 | 升序或降序 |
排序依据 | 字符串 | 用于排序的字段 API 名称 |
页码 | 整数 | 页码(默认值:1) |
每页记录数 | 整数 | 每页记录数(默认值:200,最大值:200) |
自定义视图ID | 字符串 | 筛选结果的自定义视图ID |
示例 - 列出联系人:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/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
响应:
{
"data": [
{
"First_Name": "Ted",
"Email": "support@bigin.com",
"Last_Name": "Watson",
"id": "7255024000000596045"
}
],
"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-bigin/bigin/v2/Accounts?fields=Account_Name,Website')
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-bigin/bigin/v2/{module_api_name}/{record_id}
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts/7255024000000596045')
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-bigin/bigin/v2/{module_api_name}
Content-Type: application/json
{
"data": [
{
"field_api_name": "value"
}
]
}
各模块的必填字段:
| 模块 | 必填字段 |
|---|---|
| 联系人 | Last_Name |
| 账户 | Account_Name |
| 销售管道 | 流水线名称,阶段 |
| 产品 | 产品名称 |
示例 - 创建联系人:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"Last_Name": "Smith",
"First_Name": "John",
"Email": "john.smith@example.com",
"Phone": "+1-555-0123"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/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
响应:
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2026-02-06T00:28:53-08:00",
"Modified_By": {
"name": "User Name",
"id": "7255024000000590001"
},
"Created_Time": "2026-02-06T00:28:53-08:00",
"id": "7255024000000605002",
"Created_By": {
"name": "User Name",
"id": "7255024000000590001"
}
},
"message": "record added",
"status": "success"
}
]
}
示例 - 创建公司(账户):
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"Account_Name": "Acme Corporation",
"Website": "https://acme.com"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/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-bigin/bigin/v2/{module_api_name}
Content-Type: application/json
{
"data": [
{
"id": "record_id",
"field_api_name": "updated_value"
}
]
}
示例:
python <<'EOF'
import urllib.request, os, json
data = json.dumps({
"data": [{
"id": "7255024000000605002",
"Phone": "+1-555-9999"
}]
}).encode()
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts', 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-06T00:29:07-08:00",
"id": "7255024000000605002"
},
"message": "record updated",
"status": "success"
}
]
}
删除记录
DELETE /zoho-bigin/bigin/v2/{module_api_name}?ids={record_id1},{record_id2}
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
ids | 字符串 | 逗号分隔的记录ID(必需,最多100个) |
wf_trigger | 布尔值 | 执行工作流程(默认值:true) |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts?ids=7255024000000605002', 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": "7255024000000605002"
},
"message": "记录已删除",
"status": "success"
}
]
}
搜索记录
GET /zoho-bigin/bigin/v2/{module_api_name}/search
查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
criteria | 字符串 | 搜索条件(例如,(姓氏:等于:Smith)) |
电子邮件 | 字符串 | 按电子邮件地址搜索 |
电话 | 字符串 | 按电话号码搜索 |
关键词 | 字符串 | 全局文本搜索 |
页码 | 整数 | 页码 |
每页条数 | 整数 | 每页记录数(最多200条) |
条件格式: ((字段API名称:操作符:值)与/或(...))
运算符: 等于,以...开头
示例 - 按邮箱搜索:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts/search?email=support@bigin.com')
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:equals:Watson)')
req = urllib.request.Request(f'https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts/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
元数据接口
获取模块
GET /zoho-bigin/bigin/v2/settings/modules
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/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
获取用户
GET /zoho-bigin/bigin/v2/users
查询参数:
| 参数 | 类型 | 说明 |
|---|---|---|
类型 | 字符串 | 所有用户,活跃用户,管理员用户,当前用户 |
页码 | 整数 | 页码 |
每页数量 | 整数 | 每页用户数(最多200) |
示例:
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/zoho-bigin/bigin/v2/users?type=ActiveUsers')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
分页
Zoho Bigin 使用基于页面的分页,通过page和per_page参数实现:
GET /zoho-bigin/bigin/v2/{module_api_name}?fields=First_Name,Last_Name&page=1&per_page=50
响应包含分页信息:
{
"data": [...],
"info": {
"per_page": 50,
"count": 50,
"page": 1,
"more_records": true
}
}
当more_records为true时继续获取数据,每次递增page参数。
代码示例
JavaScript
const response = await fetch(
'https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts?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-bigin/bigin/v2/Contacts',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
params={'fields': 'First_Name,Last_Name,Email'}
)
data = response.json()
注意事项
- 对于列表操作,
fields参数是必需的。 - 模块API名称区分大小写(例如,
Contacts,而非contacts) - 公司通过
Accounts模块API名称访问 - 销售机会通过
Pipelines模块访问(而非Deals) - 每次创建/更新请求最多100条记录
- 每次删除请求最多100条记录
- 每次GET请求最多返回200条记录
- 在请求中使用字段API名称(而非显示名称)
- 部分模块(任务、事件、通话、笔记)需要额外的OAuth权限范围。若收到权限范围错误,请将您所需的具体操作/API及使用场景发送至Maton技术支持邮箱support@maton.ai进行联系
- 重要提示:当使用curl命令时,如果URL包含方括号,请使用
curl -g来禁用通配符解析 - 重要提示:当将curl输出通过管道传递给
jq或其他命令时,某些shell环境中可能无法正确展开如$MATON_API_KEY之类的环境变量
错误处理
| 状态码 | 含义 |
|---|---|
| 400 | 缺少Zoho Bigin连接、缺少必需参数或请求无效 |
| 401 | Maton API密钥无效或缺失,或OAuth范围不匹配 |
| 404 | URL模式无效或资源未找到 |
| 429 | 请求频率受限 |
| 4xx/5xx | 来自Zoho Bigin API的透传错误 |
常见错误代码
| 代码 | 描述 |
|---|---|
REQUIRED_PARAM_MISSING | 缺少必需参数(例如字段) |
INVALID_URL_PATTERN | API端点路径无效 |
INVALID_MODULE | 模块不存在或不受API支持 |
OAUTH_SCOPE_MISMATCH | OAuth令牌缺少访问该端点所需的权限 |
NO_PERMISSION | 执行该操作的权限不足 |
MANDATORY_NOT_FOUND | 缺少必填字段 |
INVALID_DATA | 数据类型不匹配或格式错误 |
DUPLICATE_DATA | 记录违反唯一字段约束 |
故障排除: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-bigin开头。例如:
- 正确示例:
https://gateway.maton.ai/zoho-bigin/bigin/v2/Contacts - 错误示例:
https://gateway.maton.ai/bigin/v2/Contacts
资源
文章底部电脑广告
手机广告位-内容正文底部


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