Updated on 2024-08-19 GMT+08:00

Listing Templates

Function

This API is used to list job templates. Currently, only custom templates can be queried.

URI

  • URI format

    GET /v1.0/{project_id}/streaming/job-templates

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

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

    Table 2 query parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    No

    String

    Template name. Fuzzy query by name is supported.

    tags

    No

    String

    List of tag names. The value is k=v for a single tag. Multiple tags are separated by commas (,). Example: tag1=v1,tag2=v2.

    offset

    No

    Long

    Job offset.

    limit

    No

    Integer

    Number of returned data records. The default value is 10.

    order

    No

    String

    Sorting style of the query results.

    • asc: The query results are displayed in ascending order.
    • desc: The query results are displayed in the descending order.

    The default value is desc.

Request

None

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

is_success

No

Boolean

Indicates whether the request is successful.

message

No

String

Message content.

template_list

No

Object

Information about the template list. For details, see Table 4.

Table 4 template_list parameters

Parameter

Mandatory

Type

Description

total_count

No

Integer

Total number of templates.

templates

No

Array of objects

Detailed information about a template. For details, see Table 5.

Table 5 templates parameters

Parameter

Mandatory

Type

Description

template_id

No

Integer

Template ID.

name

No

String

Template name.

desc

No

String

Template description.

create_time

No

Long

Time when the template is created.

update_time

No

Long

Time when the template is updated.

sql_body

No

String

Stream SQL statement. Contains at least the source, query, and sink parts.

job_type

No

String

Job template type.

Example Request

None

Example Response

{
    "is_success": "true",
    "message": "The template list is obtained successfully.",
    "template_list": {
        "total_count": 2,
        "templates": [
            {
                "template_id": 2,
                "name": "updatetest",
                 "desc": "Example of quick start",
                "create_time": 1578748092000,
                "update_time": 1578748092000,
                "sql_body": "select * from source_table",
                "job_type": "flink_sql_job"
            },
            {
                "template_id": 1,
                "name": "we",
                "desc": "qwe",
                "create_time": 1577951045000,
                "update_time": 1577951045000,
                "sql_body": ""
            }
        ]
    }
}

Status Codes

Table 6 describes status codes.

Table 6 Status codes

Status Code

Description

200

Template list query succeeds.

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.