cURL
curl --request POST \ --url https://www.chenyu.cn/api/open/v2/instance/save_image \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "instance_uuid": "<string>" }'
{ "code": 123, "msg": "<string>" }
将实例保存为私有镜像
import requests url = "https://www.chenyu.cn/api/open/v2/instance/save_image" headers = { "Authorization": "Bearer your_api_key", "Content-Type": "application/json" } data = { "instance_uuid": "inst_12345678-1234-1234-1234-123456789012", "image_name": "my-custom-image", "remark": "包含深度学习环境的自定义镜像" } response = requests.post(url, headers=headers, json=data) result = response.json() if result['code'] == 0: print("镜像保存成功") else: print(f"保存失败: {result['msg']}")
{ "code": 0, "msg": "保存成功" }