获取用户页面分析数据
curl --request POST \
--url https://server.codeium.com/api/v1/UserPageAnalytics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"group_name": "<string>",
"start_timestamp": "<string>",
"end_timestamp": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/UserPageAnalytics"
payload = {
"service_key": "<string>",
"group_name": "<string>",
"start_timestamp": "<string>",
"end_timestamp": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_key: '<string>',
group_name: '<string>',
start_timestamp: '<string>',
end_timestamp: '<string>'
})
};
fetch('https://server.codeium.com/api/v1/UserPageAnalytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://server.codeium.com/api/v1/UserPageAnalytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_key' => '<string>',
'group_name' => '<string>',
'start_timestamp' => '<string>',
'end_timestamp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://server.codeium.com/api/v1/UserPageAnalytics"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://server.codeium.com/api/v1/UserPageAnalytics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v1/UserPageAnalytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"userTableStats": [
{
"name": "<string>",
"email": "<string>",
"lastUpdateTime": "<string>",
"apiKey": "<string>",
"activeDays": 123,
"disableCodeium": true,
"role": "<string>",
"signupTime": "<string>",
"lastAutocompleteUsageTime": "<string>",
"lastChatUsageTime": "<string>",
"lastCommandUsageTime": "<string>",
"promptCreditsUsed": 123,
"teamStatus": "<string>"
}
],
"billingCycleStart": "<string>",
"billingCycleEnd": "<string>",
"error": "<string>"
}分析 API
获取用户页面分析数据
获取团队页面中的用户活动统计数据,包括姓名、电子邮件、上次活动时间、活跃天数以及已使用的提示额度。
POST
/
api
/
v1
/
UserPageAnalytics
获取用户页面分析数据
curl --request POST \
--url https://server.codeium.com/api/v1/UserPageAnalytics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"service_key": "<string>",
"group_name": "<string>",
"start_timestamp": "<string>",
"end_timestamp": "<string>"
}
'import requests
url = "https://server.codeium.com/api/v1/UserPageAnalytics"
payload = {
"service_key": "<string>",
"group_name": "<string>",
"start_timestamp": "<string>",
"end_timestamp": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_key: '<string>',
group_name: '<string>',
start_timestamp: '<string>',
end_timestamp: '<string>'
})
};
fetch('https://server.codeium.com/api/v1/UserPageAnalytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://server.codeium.com/api/v1/UserPageAnalytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_key' => '<string>',
'group_name' => '<string>',
'start_timestamp' => '<string>',
'end_timestamp' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://server.codeium.com/api/v1/UserPageAnalytics"
payload := strings.NewReader("{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://server.codeium.com/api/v1/UserPageAnalytics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v1/UserPageAnalytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_key\": \"<string>\",\n \"group_name\": \"<string>\",\n \"start_timestamp\": \"<string>\",\n \"end_timestamp\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"userTableStats": [
{
"name": "<string>",
"email": "<string>",
"lastUpdateTime": "<string>",
"apiKey": "<string>",
"activeDays": 123,
"disableCodeium": true,
"role": "<string>",
"signupTime": "<string>",
"lastAutocompleteUsageTime": "<string>",
"lastChatUsageTime": "<string>",
"lastCommandUsageTime": "<string>",
"promptCreditsUsed": 123,
"teamStatus": "<string>"
}
],
"billingCycleStart": "<string>",
"billingCycleEnd": "<string>",
"error": "<string>"
}概览
请求
具有“Teams 只读”权限的服务密钥
将结果筛选为特定组中的用户 (可选)
开始时间,采用 RFC 3339 格式 (例如:
2023-01-01T00:00:00Z) 。仅影响 activeDays 的计算。 如果未提供,则默认为 1 年前。结束时间,采用 RFC 3339 格式 (例如:
2023-12-31T23:59:59Z) 。仅影响 activeDays 的计算。 如果未提供,则默认为当前时间。请求示例
curl -X POST --header "Content-Type: application/json" \
--data '{
"service_key": "your_service_key_here",
"group_name": "engineering_team",
"start_timestamp": "2024-01-01T00:00:00Z",
"end_timestamp": "2024-12-31T23:59:59Z"
}' \
https://server.codeium.com/api/v1/UserPageAnalytics
响应
用户统计对象数组
显示 用户统计对象
显示 用户统计对象
用户的显示名称
用户的电子邮件地址
用户最近一次活动的时间戳,采用 RFC 3339 格式
用户 API 密钥的哈希值
用户在查询时间范围内的活跃天数 (由
start_timestamp 和 end_timestamp 定义) 。如果用户在某一天接受了任意自动补全建议、使用了 Cascade,或使用了命令,则该天计为活跃。表示该用户的 Devin Desktop 访问权限是否已被 Admin 禁用。仅当访问权限被明确禁用时,此字段才会出现,且在这种情况下其值始终为 true。
用户在团队中的角色 (例如:admin、member)
用户注册时的时间戳,采用 RFC 3339 格式
最近一次使用 Tab/Autocomplete 模式的时间戳,采用 RFC 3339 格式
最近一次使用 Cascade 模式的时间戳,采用 RFC 3339 格式
最近一次使用 Command 模式的时间戳,采用 RFC 3339 格式
此用户在当前账单周期内使用的提示额度总数,以分为单位返回 (1 提示额度 = 100 分) 。要获取实际提示额度用量,请将此值除以 100。此值不受
start_timestamp 或 end_timestamp 请求参数影响。账单周期的时间范围由顶层的 billingCycleStart 和 billingCycleEnd 字段指示。用户的团队成员状态。可能的值有:
USER_TEAM_STATUS_UNSPECIFIED、USER_TEAM_STATUS_PENDING、USER_TEAM_STATUS_APPROVED、USER_TEAM_STATUS_REJECTED。请注意,API 会返回所有用户,无论其团队状态如何,而 “Manage Members” 界面仅显示已批准的用户。当前账单周期的开始时间,采用 RFC 3339 格式。
userTableStats 中的 promptCreditsUsed 值对应此账单周期内的用量。当前账单周期的结束时间,采用 RFC 3339 格式。
userTableStats 中的 promptCreditsUsed 值对应此账单周期内的用量。响应示例
{
"userTableStats": [
{
"name": "Alice",
"email": "alice@cognition.ai",
"lastUpdateTime": "2024-10-10T22:56:10.771591Z",
"apiKey": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"activeDays": 178,
"role": "admin",
"signupTime": "2024-01-15T08:30:00Z",
"lastAutocompleteUsageTime": "2024-10-10T22:56:10Z",
"lastChatUsageTime": "2024-10-10T20:30:00Z",
"promptCreditsUsed": 12500,
"teamStatus": "USER_TEAM_STATUS_APPROVED"
},
{
"name": "Bob",
"email": "bob@cognition.ai",
"lastUpdateTime": "2024-10-10T18:11:23.980237Z",
"apiKey": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
"activeDays": 210,
"role": "member",
"signupTime": "2024-02-01T10:00:00Z",
"lastAutocompleteUsageTime": "2024-10-10T18:11:23Z",
"lastChatUsageTime": "2024-10-09T14:22:00Z",
"lastCommandUsageTime": "2024-10-08T09:15:00Z",
"promptCreditsUsed": 8300,
"teamStatus": "USER_TEAM_STATUS_APPROVED"
}
],
"billingCycleStart": "2024-10-01T00:00:00Z",
"billingCycleEnd": "2024-11-01T00:00:00Z"
}
错误响应
说明出错原因的错误消息
- 服务密钥无效或权限不足
- 时间戳格式无效
- 未找到组
- 超出速率限制
⌘I

