POST
/
api
/
open
/
v2
/
instance
/
shutdown
实例关机
curl --request POST \
  --url https://www.chenyu.cn/api/open/v2/instance/shutdown \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "instance_uuid": "<string>"
}'
{
  "code": 123,
  "msg": "<string>"
}

实例关机

关闭一个正在运行的实例。
关机操作会停止实例的运行,请确保已保存重要数据。

请求参数

instance_uuid
string
required
要关闭的实例uuid

响应参数

code
integer
响应码
msg
string
响应信息

代码示例

import requests

url = "https://www.chenyu.cn/api/open/v2/instance/shutdown"
headers = {
    "Authorization": "Bearer your_api_key",
    "Content-Type": "application/json"
}

data = {
    "instance_uuid": "inst_12345678-1234-1234-1234-123456789012"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

if result['code'] == 0:
    print("实例关机成功")
else:
    print(f"关机失败: {result['msg']}")

响应示例

{
  "code": 0,
  "msg": "关机成功"
}