容器
获取镜像列表
1.接口说明
接口路径:/ai/openapi/v2/image/images
请求方式:POST
请求数据类型:
接口描述:获取镜像列表
2.请求消息
请求参数:
Headers:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1N... |
参数:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| name | string | 否 | 镜像名字加版本 | test |
| access | string | 是 | 镜像权限(public、private) | private |
| type | string | 否 | 镜像类型(JupyterLab、CodeServer、RStudio、Base等) | |
| orderBy | string | 是 | 排序字段,:create_time创建时间,share_time发布时间,clone_times克隆次数 | create_time |
| limit | integer | 是 | 分页查询条件,每页数量 | 20 |
| start | integer | 是 | 分页查询条件,起始条数 | 0 |
| sort | string | 是 | 排序方式 | DESC |
| acceleratorType | string | 否 | 加速器类型 | dcu |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/ai/openapi/v2/image/images' \
--header 'token: <Token>' \
--data '{
"access": "private",
"start": 0,
"limit": 20,
"sort": "DESC",
"orderBy": "create_time",
"name": "test",
"type": "",
"acceleratorType": "dcu"
}'Java请求示例
java
import okhttp3.*;
public class GetImageListDemo {
public static final String TOKEN = "<Token>";
public static final String URL = "https://scnet-demo.accloud.cn/ai/openapi/v2/image/images";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
String jsonBody = "{\"access\":\"private\",\"start\":0,\"limit\":20,\"sort\":\"DESC\",\"orderBy\":\"create_time\",\"name\":\"test\",\"type\":\"\",\"acceleratorType\":\"dcu\"}";
RequestBody body = RequestBody.create(mediaType, jsonBody);
Request request = new Request.Builder()
.url(URL)
.method("POST", body)
.addHeader("token", TOKEN)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Python请求示例
python
import requests
import json
url = "https://scnet-demo.accloud.cn/ai/openapi/v2/image/images"
payload = json.dumps({
"access": "private",
"start": 0,
"limit": 20,
"sort": "DESC",
"orderBy": "create_time",
"name": "test",
"type": "",
"acceleratorType": "dcu"
})
headers = {
"token": "<Token>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)4.响应消息
返回参数:
| 名称 | 类型 | 描述 | 示例 |
|---|---|---|---|
| msg | string | 信息 | success |
| code | string | 状态码 | 0 |
| data | array | 镜像列表 | |
| id | string | id | 5e23ad61364e4b49bfcb1b30ff0a49d7 |
| imageId | string | 镜像层id | sha256:cc03686685ed3cef130ff989aca50e90bf98b7a4e1c8e552cedca643a5868f91 |
| name | string | 镜像名 | custom |
| tag | string | 标签 | vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461 |
| appIcon | string | 图标 | /resource/appicon/acx/imagemgt/appicon/appicon_base.png |
| createTime | string | 创建时间 | 2025-02-28 12:14:46 |
| access | string | 权限 | public |
| user | string | 上传用户 | admin |
| type | string | 镜像类型 | Base |
| acceleratorType | string | 加速器类型 | dcu |
| path | string | 镜像路径 | image.ac.com:5000/dcu/admin/base/custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461 |
| version | string | 版本 | custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461 |
| isPresetImage | boolean | 是否预置镜像 | true |
| description | string | 镜像描述 | |
| imageSize | string | 镜像大小 | 6445336813 |
| shareTime | string | 共享时间 | 2025-02-28 12:14:46 |
| isSubscribe | string | 是否订阅 | |
| targetUserType | string | 目标用户类型 | all |
| shareGroups | string | 共享的用户组 | |
| isSubscribable | string | 是否可以被订阅 | false |
| shareImageName | string | 共享镜像名称 | custom |
| shareImageTag | string | 共享镜像标签 | vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461 |
| shareAppIcon | string | 共享镜像图标 | /resource/appicon/acx/imagemgt/appicon/appicon_base.png |
| shareDescription | string | 共享镜像描述 | |
| status | string | 状态 | Completed |
| imageTypes | string | 镜像类型 | |
| operationType | string | 操作类型 | |
| sourceImagePath | string | 源镜像路径 | |
| cloneTimes | int | 镜像被克隆次数 | 1 |
返回示例:
json
{
"code": "0",
"data": {
"total": 1,
"data": [
{
"id": "5e23ad61364e4b49bfcb1b30ff0a49d7",
"imageId": "sha256:cc03686685ed3cef130ff989aca50e90bf98b7a4e1c8e552cedca643a5868f91",
"name": "custom",
"tag": "vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461",
"appIcon": "/resource/appicon/acx/imagemgt/appicon/appicon_base.png",
"createTime": "2025-02-28 12:14:46",
"access": "public",
"user": "admin",
"type": "Base",
"acceleratorType": "dcu",
"path": "image.ac.com:5000/dcu/admin/base/custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461",
"version": "custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461",
"isPresetImage": true,
"description": null,
"imageSize": "6445336813",
"shareTime": "2025-02-28 12:14:46",
"isSubscribe": null,
"targetUserType": "all",
"shareGroups": null,
"isSubscribable": "false",
"shareImageName": "custom",
"shareImageTag": "vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461",
"shareAppIcon": "/resource/appicon/acx/imagemgt/appicon/appicon_base.png",
"shareDescription": null,
"status": "Completed",
"imageTypes": null,
"operationType": null,
"sourceImagePath": null,
"cloneTimes": 1
}
]
},
"msg": "success"
}5.错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 内部错误 |
| 10003 | 参数不全 |
| 10004 | 参数无效 |
| 10007 | 用户已被冻结 |
| 10008 | 权限不足 |
| 10009 | 没有权限访问接口 |
| 10010 | 文件校验失败 |
| 10011 | 文件过大 |
| 10012 | 连接中断 |