容器
获取资源分组
1.接口说明
接口路径:/ai/openapi/v2/instance-service/resource-group
请求方式:GET
请求数据类型:
接口描述:获取资源分组
2.请求消息
请求参数:
Headers:
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1... |
参数: 无
3.请求示例
cURL请求示例
curl --location 'https://api01.xxx.com:65106/ai/openapi/v2/instance-service/resource-group' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
Java请求示例
import okhttp3.*;
public class GetResourceGroupDemo {
public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api01.xxx.com:65106/ai/openapi/v2/instance-service/resource-group")
.method("GET", null)
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Python请求示例
import requests
url = "https://api01.xxx.com:65106/ai/openapi/v2/instance-service/resource-group"
payload = {}
headers = {
'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODYxMjMzNDY1NjgiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.iQUBzN32jiCeeFuJ9lFS_XjBpxenEEupQRiyA3Ef334'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
4.响应消息
返回参数:
名称 | 类型 | 描述 | 示例 |
---|---|---|---|
msg | string | 信息 | 操作成功 |
code | string | 状态码 | 0 |
data | Object | 返回值 | |
dcu | array | dcu对应资源分组 | |
gpu | array | gpu对应资源分组 | |
mlu | array | mlu对应资源分组 | |
cpu | array | 单cpu资源分组 |
返回示例:
{"code":"0",
"msg":"success",
"data":{
"gpu":["TeslaM40"],
"dcu":["DCU"]
}
}
5.错误码
错误码 | 说明 |
---|---|
0 | 成功 |
10001 | 内部异常(其他异常) |
10003 | 参数不全 |
10004 | 参数无效 |
10007 | 用户已被冻结 |
10008 | 权限不足 |
10009 | 没有权限访问接口 |
10010 | 文件校验失败 |
10011 | 文件过大 |
10012 | 连接中断 |