sentry
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSentry API
Sentry API
Use the Sentry API via direct calls to manage error tracking, issues, projects, and releases.
curlOfficial docs:https://docs.sentry.io/api/
通过直接调用来使用Sentry API,以管理错误追踪、问题、项目和版本发布。
curl官方文档:https://docs.sentry.io/api/
When to Use
适用场景
Use this skill when you need to:
- List and search issues - find errors and exceptions
- Resolve or ignore issues - manage issue status
- View issue details - get stack traces and event data
- Manage projects - list and configure projects
- Track releases - create and monitor releases
- View events - get detailed error events
当你需要以下操作时,可使用该技能:
- 查看并搜索问题 - 查找错误和异常
- 解决或忽略问题 - 管理问题状态
- 查看问题详情 - 获取堆栈跟踪和事件数据
- 管理项目 - 查看并配置项目
- 跟踪版本发布 - 创建并监控版本发布
- 查看事件 - 获取详细的错误事件
Prerequisites
前置条件
- Go to Sentry → Settings (gear icon in sidebar) → Account → API → Personal Tokens
- Click Create New Token
- Select the required scopes (see below) — scopes cannot be edited after creation
- Copy the generated token
bash
export SENTRY_HOST="sentry.io" # Or your self-hosted Sentry domain
export SENTRY_TOKEN="sntrys_..." # Personal Auth Token
export SENTRY_ORG="your-org-slug" # Your organization slug- 进入Sentry → 设置(侧边栏的齿轮图标)→ 账户 → API → 个人令牌
- 点击创建新令牌
- 选择所需的权限范围(见下文)——权限范围创建后无法编辑
- 复制生成的令牌
bash
export SENTRY_HOST="sentry.io" # 或你的自托管Sentry域名
export SENTRY_TOKEN="sntrys_..." # 个人认证令牌
export SENTRY_ORG="your-org-slug" # 你的组织别名Required Scopes
所需权限范围
- - List and view projects
project:read - - View issues and events
event:read - - Update issues (resolve, ignore, assign)
event:write - - View and create releases
project:releases
Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
- - 查看项目列表和详情
project:read - - 查看问题和事件
event:read - - 更新问题(解决、忽略、分配)
event:write - - 查看并创建版本发布
project:releases
重要提示: 当在包含管道的命令中使用时,请将包含$VAR的命令用$VAR包裹。由于Claude Code的bug,直接使用管道时环境变量会被静默清除。bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
How to Use
使用方法
All examples below assume , , and are set.
SENTRY_HOSTSENTRY_TOKENSENTRY_ORGBase URL:
https://${SENTRY_HOST}/api/0以下所有示例均假设已设置、和环境变量。
SENTRY_HOSTSENTRY_TOKENSENTRY_ORG基础URL:
https://${SENTRY_HOST}/api/01. List Your Projects
1. 查看项目列表
Get all projects you have access to:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {slug, name, platform, dateCreated}'获取你有权限访问的所有项目:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {slug, name, platform, dateCreated}'2. Get Project Details
2. 获取项目详情
Get details for a specific project:
Note: Replacewith your actual project slug from the "List Your Projects" output above.my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{slug, name, platform, status, dateCreated}'获取特定项目的详情:
注意: 将替换为你从“查看项目列表”结果中得到的实际项目别名。my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{slug, name, platform, status, dateCreated}'3. List Organization Issues
3. 查看组织内的问题
Get all issues across the organization:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {id, shortId, title, culprit, status, count, userCount, firstSeen, lastSeen}Query parameters:
- - Filter by status
query=is:unresolved - - Filter by error type
query=error.type:TypeError - - Sort by last seen (default)
sort=date - - Sort by first seen
sort=new - - Sort by event count
sort=freq
获取组织内的所有问题:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {id, shortId, title, culprit, status, count, userCount, firstSeen, lastSeen}'查询参数:
- - 按状态筛选
query=is:unresolved - - 按错误类型筛选
query=error.type:TypeError - - 按最后出现时间排序(默认)
sort=date - - 按首次出现时间排序
sort=new - - 按事件数量排序
sort=freq
4. List Project Issues
4. 查看项目内的问题
Get issues for a specific project:
Note: Replacewith your actual project slug from the "List Your Projects" output.my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {id, shortId, title, status, count, lastSeen}获取特定项目的问题:
注意: 将替换为你从“查看项目列表”结果中得到的实际项目别名。my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {id, shortId, title, status, count, lastSeen}'5. Search Issues
5. 搜索问题
Search issues with query:
Write to :
/tmp/sentry_query.txtis:unresolved level:errorbash
bash -c 'curl -s -G "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --data-urlencode "query@/tmp/sentry_query.txt"' | jq '.[] | {shortId, title, level, count}Common query filters:
- /
is:unresolved/is:resolved- By statusis:ignored - /
level:error/level:warning- By levellevel:info - /
assigned:me- By assigneeassigned:none - - By browser
browser:Chrome - - By OS
os:Windows - - By release version
release:1.0.0
使用查询语句搜索问题:
写入内容到:
/tmp/sentry_query.txtis:unresolved level:errorbash
bash -c 'curl -s -G "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --data-urlencode "query@/tmp/sentry_query.txt"' | jq '.[] | {shortId, title, level, count}'常用查询筛选条件:
- /
is:unresolved/is:resolved- 按状态is:ignored - /
level:error/level:warning- 按级别level:info - /
assigned:me- 按经办人assigned:none - - 按浏览器
browser:Chrome - - 按操作系统
os:Windows - - 按版本号
release:1.0.0
6. Get Issue Details
6. 获取问题详情
Get details for a specific issue:
Note: Replacewith an actual issue ID from the "List Issues" or "List Project Issues" output (use the123456789field, notid).shortId
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{id, shortId, title, culprit, status, level, count, userCount, firstSeen, lastSeen, assignedTo}'获取特定问题的详情:
注意: 将替换为你从“查看问题列表”或“查看项目内的问题”结果中得到的实际问题ID(使用123456789字段,而非id)。shortId
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{id, shortId, title, culprit, status, level, count, userCount, firstSeen, lastSeen, assignedTo}'7. Get Latest Event for Issue
7. 获取问题的最新事件
Get the most recent event for an issue:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/events/latest/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{eventID, message, platform, dateCreated, tags, contexts}'获取某个问题的最近一次事件:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/events/latest/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{eventID, message, platform, dateCreated, tags, contexts}'8. List Issue Events
8. 获取问题的所有事件
Get all events for an issue:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/events/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {eventID, message, dateCreated}获取某个问题的所有事件:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/events/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {eventID, message, dateCreated}'9. Resolve Issue
9. 解决问题
Mark an issue as resolved:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"Write to :
/tmp/sentry_request.jsonjson
{
"status": "resolved"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'将问题标记为已解决:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"写入内容到:
/tmp/sentry_request.jsonjson
{
"status": "resolved"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'10. Resolve in Next Release
10. 标记为下一个版本解决
Mark issue as resolved in next release:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"Write to :
/tmp/sentry_request.jsonjson
{
"status": "resolvedInNextRelease"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'将问题标记为在下一个版本发布时自动解决:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"写入内容到:
/tmp/sentry_request.jsonjson
{
"status": "resolvedInNextRelease"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'11. Ignore Issue
11. 忽略问题
Ignore an issue:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"Write to :
/tmp/sentry_request.jsonjson
{
"status": "ignored"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'Ignore with duration (in minutes):
Write to :
/tmp/sentry_request.jsonjson
{
"status": "ignored",
"statusDetails": {
"ignoreDuration": 60
}
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'忽略某个问题:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"写入内容到:
/tmp/sentry_request.jsonjson
{
"status": "ignored"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'设置忽略时长(分钟):
写入内容到:
/tmp/sentry_request.jsonjson
{
"status": "ignored",
"statusDetails": {
"ignoreDuration": 60
}
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'12. Unresolve Issue
12. 重新打开问题
Reopen a resolved issue:
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"Write to :
/tmp/sentry_request.jsonjson
{
"status": "unresolved"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'将已解决的问题重新标记为未解决:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"写入内容到:
/tmp/sentry_request.jsonjson
{
"status": "unresolved"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, status}'13. Assign Issue
13. 分配问题
Assign an issue to a user:
Note: Replacewith an actual issue ID from the "List Issues" output. Replace123456789with a valid user email from your Sentry organization members.<user-email>
Write to :
/tmp/sentry_request.jsonjson
{
"assignedTo": "<user-email>"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, assignedTo}'Note: Replacein the URL with the actual issue ID from the "List Issues" output.123456789
将问题分配给指定用户:
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。将123456789替换为Sentry组织成员中的有效用户邮箱。<user-email>
写入内容到:
/tmp/sentry_request.jsonjson
{
"assignedTo": "<user-email>"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{id, shortId, assignedTo}'注意: 将URL中的替换为“查看问题列表”结果中的实际问题ID。123456789
14. Bulk Update Issues
14. 批量更新问题
Update multiple issues at once:
Note: Replaceand123456789with actual issue IDs from the "List Issues" output.987654321
Write to :
/tmp/sentry_request.jsonjson
{
"id": ["123456789", "987654321"],
"status": "resolved"
}Then run:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json'同时更新多个问题:
注意: 将和123456789替换为你从“查看问题列表”结果中得到的实际问题ID。987654321
写入内容到:
/tmp/sentry_request.jsonjson
{
"id": ["123456789", "987654321"],
"status": "resolved"
}然后运行:
bash
bash -c 'curl -s -X PUT "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json'15. Delete Issue
15. 删除问题
Delete an issue (requires admin permissions):
Note: Replacewith an actual issue ID from the "List Issues" output.123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s -X DELETE "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" -w "\nHTTP Status: %{http_code}"'删除某个问题(需要管理员权限):
注意: 将替换为你从“查看问题列表”结果中得到的实际问题ID。123456789
bash
ISSUE_ID="123456789"
bash -c 'curl -s -X DELETE "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/issues/${ISSUE_ID}/" --header "Authorization: Bearer ${SENTRY_TOKEN}" -w "\nHTTP Status: %{http_code}"'16. List Releases
16. 查看版本发布列表
Get all releases for the organization:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {version, dateCreated, newGroups, projects: [.projects[].slug]}'获取组织内的所有版本发布:
bash
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {version, dateCreated, newGroups, projects: [.projects[].slug]}'17. Get Release Details
17. 获取版本发布详情
Get details for a specific release:
Note: Replacewith an actual release version from the "List Releases" output.1.0.0
bash
RELEASE_VERSION="1.0.0"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/${RELEASE_VERSION}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{version, dateCreated, dateReleased, newGroups, lastEvent, projects}'获取特定版本发布的详情:
注意: 将替换为你从“查看版本发布列表”结果中得到的实际版本号。1.0.0
bash
RELEASE_VERSION="1.0.0"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/${RELEASE_VERSION}/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '{version, dateCreated, dateReleased, newGroups, lastEvent, projects}'18. Create Release
18. 创建版本发布
Create a new release:
Note: Replacewith your actual project slug from the "List Your Projects" output.<your-project-slug>
Write to :
/tmp/sentry_request.jsonjson
{
"version": "1.0.1",
"projects": ["<your-project-slug>"]
}Then run:
bash
bash -c 'curl -s -X POST "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{version, dateCreated}'创建一个新的版本发布:
注意: 将替换为你从“查看项目列表”结果中得到的实际项目别名。<your-project-slug>
写入内容到:
/tmp/sentry_request.jsonjson
{
"version": "1.0.1",
"projects": ["<your-project-slug>"]
}然后运行:
bash
bash -c 'curl -s -X POST "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{version, dateCreated}'19. Create Release with Commits
19. 创建关联提交的版本发布
Create release with associated commits:
Note: Replacewith your actual project slug from the "List Your Projects" output.<your-project-slug>
Write to :
/tmp/sentry_request.jsonjson
{
"version": "1.0.2",
"projects": ["<your-project-slug>"],
"refs": [
{
"repository": "owner/repo",
"commit": "abc123def456"
}
]
}Then run:
bash
bash -c 'curl -s -X POST "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{version, dateCreated}'创建包含关联代码提交的版本发布:
注意: 将替换为你从“查看项目列表”结果中得到的实际项目别名。<your-project-slug>
写入内容到:
/tmp/sentry_request.jsonjson
{
"version": "1.0.2",
"projects": ["<your-project-slug>"],
"refs": [
{
"repository": "owner/repo",
"commit": "abc123def456"
}
]
}然后运行:
bash
bash -c 'curl -s -X POST "https://${SENTRY_HOST}/api/0/organizations/${SENTRY_ORG}/releases/" --header "Authorization: Bearer ${SENTRY_TOKEN}" --header "Content-Type: application/json" -d @/tmp/sentry_request.json' | jq '{version, dateCreated}'20. List Project Error Events
20. 查看项目的错误事件
Get recent error events for a project:
Note: Replacewith your actual project slug from the "List Your Projects" output.my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/events/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {eventID, title, message, dateCreated}'获取某个项目的近期错误事件:
注意: 将替换为你从“查看项目列表”结果中得到的实际项目别名。my-project
bash
PROJECT_SLUG="my-project"
bash -c 'curl -s "https://${SENTRY_HOST}/api/0/projects/${SENTRY_ORG}/${PROJECT_SLUG}/events/" --header "Authorization: Bearer ${SENTRY_TOKEN}"' | jq '.[] | {eventID, title, message, dateCreated}'Issue Status Values
问题状态值
| Status | Description |
|---|---|
| Active issue (default) |
| Manually resolved |
| Auto-resolve on next release |
| Ignored (won't alert) |
| 状态 | 描述 |
|---|---|
| 活跃问题(默认) |
| 手动标记为已解决 |
| 下一个版本发布时自动解决 |
| 已忽略(不会触发告警) |
Guidelines
注意事项
- Use organization slug: Most endpoints use org slug, not ID
- Pagination: Use parameter for paginated results
cursor - Query syntax: Use Sentry's query language for powerful filtering
- Rate limits: Sentry has rate limits; implement backoff for 429 responses
- Self-hosted: For self-hosted Sentry, set to your domain
SENTRY_HOST - Scopes matter: Ensure your token has required scopes for each operation
- 使用组织别名:大多数接口使用组织别名,而非ID
- 分页处理:使用参数处理分页结果
cursor - 查询语法:使用Sentry的查询语言进行强大的筛选
- 速率限制:Sentry有请求速率限制;遇到429响应时请实现退避机制
- 自托管部署:对于自托管的Sentry,将设置为你的域名
SENTRY_HOST - 权限范围很重要:确保你的令牌拥有每个操作所需的权限范围