九章智算云
设置定时关机

设置实例的定时关机时间,到点后实例自动关机(单次有效,生效后配置重置为关闭)。时间按分钟生效。

POSThttps://api.alayanew.com/api/osm/v1/cci/instance/{id}/set-auto-shutdown

鉴权(Authorizations)

AuthorizationString必填

用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。

Path Parameters

idString必填

实例 ID(来自查询实例列表的 id)。例如:2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88。

Request body

autoShutdownEnableBoolean

是否开启定时关机。例如:true。

shutdownTimeString

定时关机时间,格式 yyyy-MM-dd HH:mm:ss;开启时必传且须晚于当前时间,按分钟生效。例如:"2026-10-14 22:00:00"。

Response

statusInteger

业务状态码,200 表示设置成功;失败时为错误码。

messageString

响应信息,成功为 "OK";失败时为错误描述。

curl -X 'POST' \
  'https://api.alayanew.com/api/osm/v1/cci/instance/2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88/set-auto-shutdown' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: [your-auth-header]' \
  -d '{
  "autoShutdownEnable": true,
  "shutdownTime": "2026-10-14 22:00:00"
}'
import requests

instance_id = "2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88"
url = f"https://api.alayanew.com/api/osm/v1/cci/instance/{instance_id}/set-auto-shutdown"
headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "[your-auth-header]"
}
payload = {
    "autoShutdownEnable": True,
    "shutdownTime": "2026-10-14 22:00:00"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
const instanceId = '2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88';
const payload = {
  autoShutdownEnable: true,
  shutdownTime: '2026-10-14 22:00:00'
};

fetch(`https://api.alayanew.com/api/osm/v1/cci/instance/${instanceId}/set-auto-shutdown`, {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': '[your-auth-header]'
  },
  body: JSON.stringify(payload)
})
  .then(res => res.json())
  .then(console.log)
  .catch(console.error);
{
  "status": 200,
  "message": "OK"
}

最后更新于