Updated on 2026-01-08 GMT+08:00

Updating a Template

Function

This API is used to update existing templates in DLI.

Authorization

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see the required permissions in Introduction.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    dli:template:update

    write

    template *

    -

    -

    -

URI

  • URI format

    PUT /v1.0/{project_id}/streaming/job-templates/{template_id}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain a project ID, see Obtaining a Project ID.

    template_id

    Yes

    String

    Template ID.

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

name

No

String

Template name. The value can contain 0 to 64 characters.

desc

No

String

Template description. Length range: 0 to 512 characters.

sql_body

No

String

Stream SQL statement, which includes at least the following three parts: source, query, and sink. The value can contain 0 to 10,000 characters.

Response Parameters

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Indicates whether the request is successfully executed. Value true indicates that the request is successfully executed.

message

No

String

System prompt. If execution succeeds, the parameter setting may be left blank.

Example Request

Update job template information, including the template name, template description, and template SQL statements.

{
    "name": "simple_stream_sql",
    "desc": "Example of quick start",
    "sql_body": "select * from source_table"
}

Example Response

{
    "is_success": "true",
    "message": "The template is successfully updated.",
}

Status Codes

Table 4 describes status codes.

Table 4 Status codes

Status Code

Description

200

A template is updated successfully.

400

The input parameter is invalid.

Error Codes

If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.