Skip to Content
GPU API 接口

获取团队详情

接口说明

获取指定团队的详细信息及成员关系列表。可通过 TeamId 或 VirtualCompanyId 查询,二选一。

POSThttps://api.compshare.cnActionGetCompShareTeamInfo

使用限制

  • TeamId 与 VirtualCompanyId 二选一,至少传入其中一个。

请求参数

名称类型必填描述示例值
ActionString接口名称GetCompShareTeamInfo
RegionString地域cn-wlcb
TeamIdUint32否*团队 ID(与 VirtualCompanyId 二选一)1001
VirtualCompanyIdUint32否*虚拟企业 ID(与 TeamId 二选一)60001

* TeamId 与 VirtualCompanyId 必须传入其中一个。


响应参数

名称类型描述示例值
ActionString响应名称GetCompShareTeamInfoResponse
RetCodeInteger返回码,0 为成功0
TeamCompShareTeamInfo团队基本信息见下方
TeamRelationArray<CompShareTeamRelationInfo>团队成员关系列表见下方

CompShareTeamInfo

名称类型描述示例值
IdUint32团队 ID1001
NameString团队名称my-team
CompanyIdUint32企业 ID50001
DescriptionString团队简介AI研发团队

CompShareTeamRelationInfo

名称类型描述示例值
TeamIdUint32团队 ID1001
TeamNameString团队名称my-team
UserCompanyIdUint32用户企业 ID50001
VirtualCompanyIdUint32虚拟企业 ID60001
StatusString成员状态joined
RemarkNameString备注名张三
AllocateAmountInt64已分配额度(单位分)100000
AvailableAmountInt64可用额度(单位分)80000

请求示例

Python(使用 UCloud SDK)

安装 SDK:

pip install --upgrade ucloud-sdk-python3

示例代码:

from ucloud.core import exc from ucloud.client import Client def main(): client = Client({ "region": "cn-wlcb", "public_key": "my_public_key", # 替换为你的公钥(控制台 账户中心 → API 密钥:https://console.compshare.cn/uaccount/api_manage) "private_key": "my_private_key", # 替换为你的私钥 "base_url": "https://api.compshare.cn", }) try: resp = client.ucompshare().get_comp_share_team_info({ "TeamId": 1001, }) team = resp.get("Team", {}) print(f"团队: {team['Name']} (ID: {team['Id']})") for member in resp.get("TeamRelation", []): print(f" 成员: {member['RemarkName']} (状态: {member['Status']}, 可用额度: {member['AvailableAmount']})") except exc.UCloudException as e: print(e) if __name__ == "__main__": main()

Go(使用 UCloud SDK)

安装依赖:

go get github.com/ucloud/ucloud-sdk-go

示例代码:

package main import ( "fmt" "github.com/ucloud/ucloud-sdk-go/services/ucompshare" "github.com/ucloud/ucloud-sdk-go/ucloud" "github.com/ucloud/ucloud-sdk-go/ucloud/auth" ) func main() { cfg := ucloud.NewConfig() cfg.Region = "cn-wlcb" cfg.BaseUrl = "https://api.compshare.cn" credential := auth.NewCredential() credential.PublicKey = "my_public_key" // 替换为你的公钥(控制台 账户中心 → API 密钥:https://console.compshare.cn/uaccount/api_manage) credential.PrivateKey = "my_private_key" // 替换为你的私钥 client := ucompshare.NewClient(&cfg, &credential) req := client.NewGetCompShareTeamInfoRequest() req.TeamId = ucloud.Uint(1001) resp, err := client.GetCompShareTeamInfo(req) if err != nil { fmt.Printf("查询失败: %s\n", err) return } fmt.Printf("团队: %s (ID: %d)\n", resp.Team.Name, resp.Team.Id) for _, member := range resp.TeamRelation { fmt.Printf(" 成员: %s (状态: %s, 可用额度: %d)\n", member.RemarkName, member.Status, member.AvailableAmount) } }

响应示例

{ "Action": "GetCompShareTeamInfoResponse", "RetCode": 0, "Team": { "Id": 1001, "Name": "my-team", "CompanyId": 50001, "Description": "AI研发团队" }, "TeamRelation": [ { "TeamId": 1001, "TeamName": "my-team", "UserCompanyId": 50001, "VirtualCompanyId": 60001, "Status": "joined", "RemarkName": "张三", "AllocateAmount": 100000, "AvailableAmount": 80000 } ] }
Last updated on