错误追踪设置 API
- Tier: 基础版,专业版,旗舰版
- Offering: JihuLab.com,私有化部署
错误追踪项目设置
项目设置 API 允许您检索项目的 错误追踪 设置。仅适用于项目的维护者角色用户。
获取错误追踪设置
plaintextGET /projects/:id/error_tracking/settings
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer | 是 | 项目的 ID 或 URL 编码路径 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings"
示例响应:
json1{ 2 "active": true, 3 "project_name": "sample sentry project", 4 "sentry_external_url": "https://sentry.io/myawesomeproject/project", 5 "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project", 6 "integrated": false 7}
创建错误追踪设置
History
- 引入于极狐GitLab 15.10。
该 API 允许您为项目创建错误追踪设置。仅适用于项目的维护者角色用户。
此 API 仅在使用 [集成错误追踪](../operations/integrated_error_tracking.md) 时可用。
plaintextPUT /projects/:id/error_tracking/settings
支持的属性:
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer | 是 | 项目的 ID 或 URL 编码路径。 |
| active | boolean | 是 | 传递 true 以启用错误追踪设置配置或传递 false 以禁用它。 |
| integrated | boolean | 是 | 传递 true 以启用集成错误追踪后端。 |
示例请求:
shellcurl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true&integrated=true"
示例响应:
json1{ 2 "active": true, 3 "project_name": null, 4 "sentry_external_url": null, 5 "api_url": null, 6 "integrated": true 7}
启用或禁用错误追踪项目设置
该 API 允许您启用或禁用项目的错误追踪设置。仅适用于项目的维护者角色用户。
plaintextPATCH /projects/:id/error_tracking/settings
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer | 是 | 项目的 ID 或 URL 编码路径。 |
| active | boolean | 是 | 传递 true 以启用已配置的错误追踪设置或传递 false 以禁用它。 |
| integrated | boolean | 否 | 传递 true 以启用集成错误追踪后端。 |
shellcurl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/1/error_tracking/settings?active=true"
示例响应:
json1{ 2 "active": true, 3 "project_name": "sample sentry project", 4 "sentry_external_url": "https://sentry.io/myawesomeproject/project", 5 "api_url": "https://sentry.io/api/0/projects/myawesomeproject/project", 6 "integrated": false 7}
错误追踪客户端密钥
适用于 集成错误追踪 功能。仅适用于项目的维护者角色用户。
列出项目客户端密钥
plaintextGET /projects/:id/error_tracking/client_keys
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID 或 URL 编码路径。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"
示例响应:
json1[ 2 { 3 "id": 1, 4 "active": true, 5 "public_key": "glet_aa77551d849c083f76d0bc545ed053a3", 6 "sentry_dsn": "https://glet_aa77551d849c083f76d0bc545ed053a3@example.com/errortracking/api/v1/projects/5" 7 }, 8 { 9 "id": 3, 10 "active": true, 11 "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3", 12 "sentry_dsn": "https://glet_aa77551d849c083f76d0bc545ed053a3@example.com/errortracking/api/v1/projects/5" 13 } 14]
创建客户端密钥
为项目创建新的客户端密钥。公共密钥属性自动生成。
plaintextPOST /projects/:id/error_tracking/client_keys
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID 或 URL 编码路径。 |
shellcurl --request POST \ --header "PRIVATE-TOKEN: <your_access_token>" \ --header "Content-Type: application/json" \ --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys"
示例响应:
json1{ 2 "id": 3, 3 "active": true, 4 "public_key": "glet_0ff98b1d849c083f76d0bc545ed053a3", 5 "sentry_dsn": "https://glet_aa77551d849c083f76d0bc545ed053a3@example.com/errortracking/api/v1/projects/5" 6}
删除客户端密钥
从项目中移除客户端密钥。
plaintextDELETE /projects/:id/error_tracking/client_keys/:key_id
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | 是 | 项目的 ID 或 URL 编码路径。 |
| key_id | integer | 是 | 客户端密钥的 ID。 |
shellcurl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \ --url "https://gitlab.example.com/api/v4/projects/5/error_tracking/client_keys/13"