Loading...
Loading...
Compare original and translation side by side
curlOfficial docs:https://docs.github.com/en/rest/copilot
curl官方文档:https://docs.github.com/en/rest/copilot
manage_billing:copilotadmin:orgGITHUB_TOKENexport GITHUB_TOKEN="ghp_xxxxxxxxxxxx"manage_billing:copilotadmin:orgGITHUB_TOKENexport GITHUB_TOKEN="ghp_xxxxxxxxxxxx"manage_billing:copilotread:orgadmin:orgImportant: 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"'
manage_billing:copilotread:orgadmin:org重要提示: 如果你在需要管道传输到其他命令的指令中使用,请将包含$VAR的命令包裹在$VAR中。由于Claude Code存在漏洞,直接使用管道时环境变量会被静默清除。bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
GITHUB_TOKENhttps://api.github.comAuthorization: Bearer ${GITHUB_TOKEN}Accept: application/vnd.github+jsonX-GitHub-Api-Version: 2022-11-28GITHUB_TOKENhttps://api.github.comAuthorization: Bearer ${GITHUB_TOKEN}Accept: application/vnd.github+jsonX-GitHub-Api-Version: 2022-11-28your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'{
"seat_breakdown": {
"total": 12,
"added_this_cycle": 2,
"pending_cancellation": 0,
"pending_invitation": 1,
"active_this_cycle": 12,
"inactive_this_cycle": 0
},
"seat_management_setting": "assign_selected",
"public_code_suggestions": "block"
}your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'{
"seat_breakdown": {
"total": 12,
"added_this_cycle": 2,
"pending_cancellation": 0,
"pending_invitation": 1,
"active_this_cycle": 12,
"inactive_this_cycle": 0
},
"seat_management_setting": "assign_selected",
"public_code_suggestions": "block"
}your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing/seats?per_page=50" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"' | jq '.seats[] | {login: .assignee.login, last_activity: .last_activity_at}'your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/billing/seats?per_page=50" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"' | jq '.seats[] | {login: .assignee.login, last_activity: .last_activity_at}'your-org-nameusernamebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/members/username/copilot" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'your-org-nameusernamebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/members/username/copilot" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'your-org-name/tmp/github_copilot_request.json{
"selected_usernames": ["user1", "user2"]
}bash -c 'curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'{
"seats_created": 2
}your-org-name/tmp/github_copilot_request.json{
"selected_usernames": ["user1", "user2"]
}bash -c 'curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'{
"seats_created": 2
}your-org-name/tmp/github_copilot_request.json{
"selected_usernames": ["user1", "user2"]
}bash -c 'curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'{
"seats_cancelled": 2
}your-org-name/tmp/github_copilot_request.json{
"selected_usernames": ["user1", "user2"]
}bash -c 'curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_users" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'{
"seats_cancelled": 2
}your-org-name/tmp/github_copilot_request.json{
"selected_teams": ["engineering", "design"]
}bash -c 'curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'your-org-name/tmp/github_copilot_request.json{
"selected_teams": ["engineering", "design"]
}bash -c 'curl -s -X POST "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'your-org-name/tmp/github_copilot_request.json{
"selected_teams": ["engineering"]
}bash -c 'curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'your-org-name/tmp/github_copilot_request.json{
"selected_teams": ["engineering"]
}bash -c 'curl -s -X DELETE "https://api.github.com/orgs/your-org-name/copilot/billing/selected_teams" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28" --header "Content-Type: application/json" -d @/tmp/github_copilot_request.json'your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/metrics?per_page=7" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"' | jq '.[] | {date, total_active_users, total_engaged_users}'{
"date": "2024-06-24",
"total_active_users": 24,
"total_engaged_users": 20
}your-org-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/copilot/metrics?per_page=7" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"' | jq '.[] | {date, total_active_users, total_engaged_users}'{
"date": "2024-06-24",
"total_active_users": 24,
"total_engaged_users": 20
}your-org-nameteam-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/team/team-name/copilot/metrics" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'your-org-nameteam-namebash -c 'curl -s -X GET "https://api.github.com/orgs/your-org-name/team/team-name/copilot/metrics" --header "Authorization: Bearer ${GITHUB_TOKEN}" --header "Accept: application/vnd.github+json" --header "X-GitHub-Api-Version: 2022-11-28"'| Field | Description |
|---|---|
| Users with Copilot activity |
| Users who accepted suggestions |
| Code completion stats by language/editor |
| IDE chat usage stats |
| GitHub.com chat usage |
| PR summary usage |
| 字段 | 描述 |
|---|---|
| 有Copilot活动记录的用户 |
| 接受了补全建议的用户 |
| 按语言/编辑器统计的代码补全数据 |
| IDE聊天功能的使用统计 |
| GitHub.com聊天功能的使用情况 |
| PR摘要功能的使用情况 |