Skip to content

容器

获取镜像列表

1.接口说明

接口路径:/ai/openapi/v2/image/images

请求方式:POST

请求数据类型:

接口描述:获取镜像列表

2.请求消息

请求参数:

Headers:

名称类型必填描述示例
tokenstring接口凭证eyJhbGciOiJIUzI1N...

参数:

名称类型必填描述示例
namestring镜像名字加版本test
accessstring镜像权限(public、private)private
typestring镜像类型(JupyterLab、CodeServer、RStudio、Base等)
orderBystring排序字段,:create_time创建时间,share_time发布时间,clone_times克隆次数create_time
limitinteger分页查询条件,每页数量20
startinteger分页查询条件,起始条数0
sortstring排序方式DESC
acceleratorTypestring加速器类型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.响应消息

返回参数:

名称类型描述示例
msgstring信息success
codestring状态码0
dataarray镜像列表
idstringid5e23ad61364e4b49bfcb1b30ff0a49d7
imageIdstring镜像层idsha256:cc03686685ed3cef130ff989aca50e90bf98b7a4e1c8e552cedca643a5868f91
namestring镜像名custom
tagstring标签vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461
appIconstring图标/resource/appicon/acx/imagemgt/appicon/appicon_base.png
createTimestring创建时间2025-02-28 12:14:46
accessstring权限public
userstring上传用户admin
typestring镜像类型Base
acceleratorTypestring加速器类型dcu
pathstring镜像路径image.ac.com:5000/dcu/admin/base/custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461
versionstring版本custom:vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461
isPresetImageboolean是否预置镜像true
descriptionstring镜像描述
imageSizestring镜像大小6445336813
shareTimestring共享时间2025-02-28 12:14:46
isSubscribestring是否订阅
targetUserTypestring目标用户类型all
shareGroupsstring共享的用户组
isSubscribablestring是否可以被订阅false
shareImageNamestring共享镜像名称custom
shareImageTagstring共享镜像标签vllm0.7.2-ubuntu22.04-dtk25.04-rc6-das1.4-py3.10-20250227-rocblas-86461
shareAppIconstring共享镜像图标/resource/appicon/acx/imagemgt/appicon/appicon_base.png
shareDescriptionstring共享镜像描述
statusstring状态Completed
imageTypesstring镜像类型
operationTypestring操作类型
sourceImagePathstring源镜像路径
cloneTimesint镜像被克隆次数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连接中断