Help Center/ ModelArts/ API Reference/ DevEnviron Management/ Prolonging a Notebook Instance
Updated on 2024-06-13 GMT+08:00

Prolonging a Notebook Instance

Function

This API is used to prolong a notebook instance.

Constraints

None

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

Indicates the running duration starting from the current time. After the running duration expires, the system automatically stops. 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

Prolong the available duration of a running notebook instance.

https://{endpoint}/v1/{project_id}/notebooks/{id}/lease

{
  "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.