跳到主要内容

停止实例

POST
/instance/stop

停止一个正在运行的实例。

鉴权

你可以在请求头中找到 AccessToken,或者从网页上复制(复制 Auth Token)。该 Token 在你登录时生成,有效期为一天。

你也可以调用登录接口来获取新的 Token,详见 登录接口

AccessToken 需要作为 Cookie 包含在请求中。在下面的 cURL 示例中,你可以看到如何使用 -b 参数传递 Token:

-b 'AccessToken=your_token_here'

注意:将 your_token_here 替换为你实际的 AccessToken。该 Token 是一个 JWT(JSON Web Token),其中包含了你的身份信息和权限。

请求体

请求体中需要包含你想要停止的实例 ID。

字段类型必填描述
instanceIdstring要停止的实例 ID

请求示例

{
"instanceId": "notebook-43f8fcd9-xxxx-xxxx-xxxx-96891d9dfb5e"
}

cURL 示例

curl 'https://cloud.luchentech.com/api/instance/stop' \
-H 'content-type: application/json' \
-b 'AccessToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9....' \
--data-raw '{"instanceId":"notebook-43f8fcd9-xxxx-xxxx-xxxx-96891d9dfb5e"}'

响应示例

成功响应

{
"instanceId":"notebook-43f8fcd9-xxxx-xxxx-xxxx-96891d9dfb5e"
}

错误响应

{
"message":"ent: instance not found"
}