Prolonging a Notebook Instance

Function

This API is used to prolong a notebook instance.

Constraints

None

Debugging

You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.

URI

PATCH /v1/{project_id}/notebooks/{id}/lease

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Notebook instance ID.

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

duration

No

Long

Renewal duration. You are advised to set this parameter in leaseReq. If the request parameter contains duration, the value of leaseReq is ignored and the automatic instance stop type is scheduled stop. (Unit: ms)

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

duration

No

Long

Scheduled stop: The running duration starts from the current time and automatically stops when the running duration expires. Idle stop: indicates the idle duration starting from the current time. When the idle duration exceeds the idle duration, the system automatically stops. The minimum idle stop value is 900000. Unit: ms.

type

No

String

Automatic stop type. The default value is timing.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

create_at

Long

Time (UTC) when the instance is created, accurate to millisecond.

duration

Long

Instance running duration, which is calculated based on the instance creation time. If the instance creation time plus the duration is greater than the current time, the system automatically stops the instance.

enable

Boolean

Whether to enable auto stop of the instance.

type

String

Indicates the automatic stop type.

update_at

Long

Time (UTC) when the instance is last updated (excluding the keepalive heartbeat time), accurate to millisecond.

Example Requests

--

--

{
  "duration" : 3600000,
  "type" : "timing"
}

Example Responses

Status code: 200

OK

{
  "create_at" : 1638841744515,
  "duration" : 3600000,
  "enable" : true,
  "type" : "TIMING",
  "update_at" : 1638843018759
}

Status Codes

Status Code

Description

200

OK

204

No Content

401

Unauthorized

403

Forbidden

Error Codes

See Error Codes.