认证
此提供商需要身份验证。
- zohoRefreshToken: Zoho 刷新令牌(必需:True,敏感:True)
- zohoClientId: Zoho 客户端 ID(必需:True,敏感:True)
- zohoClientSecret: Zoho 客户端密钥(必需:True,敏感:True)
- zohoAccountTLD: Zoho 账户的 TLD(.com | .eu | .com.cn | .in | .au | .jp)(必需:True,敏感:False)
某些范围可能需要才能通过提供商执行特定操作或查询。以下是相关范围及其用例的摘要:
- authenticated: 用户已身份验证(强制)
- valid_tld: TLD 在列表中 [.com | .eu | .com.cn | .in | .com.au | .jp](强制)
在工作流中
此提供商不能用作工作流中的"步骤"或"操作"。如果您想使用它,请通过在 GitHub 仓库 创建问题告诉我们。
主要类方法
setup_webhook(tenant_id, keep_api_url, api_key, setup_alerts)tenant_id (str):租户标识符。keep_api_url (str):发送告警数据的 URL。api_key (str):认证的 API 密钥。setup_alerts (bool):是否设置告警功能(默认为 True)。
_get_alerts()- 返回表示告警的
AlertDto对象列表。
- 返回表示告警的
连接 Provider
要使用 Site24x7 Provider,请使用必要的认证凭据和 provider 配置对其进行初始化。确保您的 Zoho 账户凭据(Client ID、Client Secret 和 Refresh Token)在 Site24x7ProviderAuthConfig 中正确设置。
获取刷新令牌的步骤
注册和客户端凭据:
- 导航至 Zoho API Console。
- 使用与您的 Site24x7 账户关联的电子邮件登录或注册。
- 使用"Self Client"选项注册您的应用程序以获取您的 Client ID 和 Client Secret。
生成授权码:
- 进入 Zoho Developer Console 并访问您注册的 Self Client。
- 在"Generate Code"标签中,输入所需的范围(
Site24x7.Admin.Read, Site24x7.Admin.Create, Site24x7.Operations.Read)、描述和时间持续时间。 - 点击"Generate"并复制提供的代码。
生成访问令牌和刷新令牌:
- 使用授权码向
https://accounts.zoho.com/oauth/v2/token发送 POST 请求以获取访问令牌和刷新令牌。
bashcurl -X POST 'https://accounts.zoho.com/oauth/v2/token' \ -d 'client_id=your_client_id' \ -d 'client_secret=your_client_secret' \ -d 'code=your_grant_token' \ -d 'grant_type=authorization_code'或者
pythonimport requests response = requests.post( 'https://accounts.zoho.com/oauth/v2/token', data={ 'client_id': 'your_client_id', 'client_secret': 'your_client_secret', 'code': 'your_grant_token', 'grant_type': 'authorization_code' } ) refresh_token = response.json().get('refresh_token')- 使用授权码向
注意事项
- 您必须使用特定于域的 Zoho 账户 URL 来生成刷新令牌,否则您会收到
invalid_client错误。请参阅 Zoho 账户数据中心。 - 确保在生成授权码时包含必要的范围 Site24x7.Admin.Read, Site24x7.Admin.Create, Site24x7.Operations.Read,因为它们决定了通过 provider 可访问的 API 功能。
- Zoho API Console 链接
Webhook 集成修改
webhook 集成授予 Keep 对 Site24x7 内以下范围的访问权限:
authenticatedvalid_tld
可以通过 Site24x7 控制台中的"Alarms"部分访问 webhook。