实例关机
关闭一个正在运行的实例。关机操作会停止实例的运行,请确保已保存重要数据。
请求参数
要关闭的实例uuid
响应参数
响应码
响应信息
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>"
}
关闭指定的实例
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>"
}
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": "关机成功"
}