Skip to Content
GPU 接口文档团队管理查询已创建的团队列表
GPU API 接口

查询已创建的团队列表

接口说明

查询当前账户已创建的团队列表。

POSThttps://api.compshare.cnActionListCompShareTeam

使用限制

  • 仅返回当前账户作为管理员创建的团队。

请求参数

名称类型必填描述示例值
ActionString接口名称ListCompShareTeam
RegionString地域cn-wlcb

响应参数

名称类型描述示例值
ActionString响应名称ListCompShareTeamResponse
RetCodeInteger返回码,0 为成功0
TeamsArray<CompShareTeamInfo>团队列表见下方

CompShareTeamInfo

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

请求示例

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().list_comp_share_team({}) teams = resp.get("Teams", []) for team in teams: print(f"团队: {team['Name']} (ID: {team['Id']}, 成员数: {team['MemberCount']})") 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.NewListCompShareTeamRequest() resp, err := client.ListCompShareTeam(req) if err != nil { fmt.Printf("查询失败: %s\n", err) return } for _, team := range resp.Teams { fmt.Printf("团队: %s (ID: %d, 成员数: %d)\n", team.Name, team.Id, team.MemberCount) } }

响应示例

{ "Action": "ListCompShareTeamResponse", "RetCode": 0, "Teams": [ { "Id": 1001, "Name": "my-team", "CompanyId": 50001, "Description": "AI研发团队", "MemberCount": 5 } ] }
Last updated on